From 645f60b210a9cf906af1bb96c88bb57bd41d9320 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 12 Jul 2022 02:04:25 +0000 Subject: [PATCH] CodeGen from PR 19592 in Azure/azure-rest-api-specs Merge 0ac17886b62812c64e44210568c8cd6999f53912 into 390ef489400d7cdb5fb7bd28c9243c79907dedbd --- .../azure-mgmt-containerservice/_meta.json | 6 +- .../containerservice/v2017_07_01/__init__.py | 13 +- .../v2017_07_01/_container_service_client.py | 4 +- .../v2017_07_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 4 +- .../v2017_07_01/aio/operations/__init__.py | 5 + .../_container_services_operations.py | 188 +-- .../v2017_07_01/aio/operations/_patch.py | 19 + .../v2017_07_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 11 +- .../v2017_07_01/models/_models_py3.py | 130 +- .../v2017_07_01/models/_patch.py | 19 + .../v2017_07_01/operations/__init__.py | 5 + .../_container_services_operations.py | 292 +++-- .../v2017_07_01/operations/_patch.py | 19 + .../containerservice/v2018_03_31/__init__.py | 13 +- .../v2018_03_31/_container_service_client.py | 8 +- .../v2018_03_31/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 8 +- .../v2018_03_31/aio/operations/__init__.py | 5 + .../_managed_clusters_operations.py | 376 ++++-- .../v2018_03_31/aio/operations/_operations.py | 48 +- .../v2018_03_31/aio/operations/_patch.py | 19 + .../v2018_03_31/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 13 +- .../v2018_03_31/models/_models_py3.py | 136 +-- .../v2018_03_31/models/_patch.py | 19 + .../v2018_03_31/operations/__init__.py | 5 + .../_managed_clusters_operations.py | 588 ++++++---- .../v2018_03_31/operations/_operations.py | 67 +- .../v2018_03_31/operations/_patch.py | 19 + .../v2018_08_01_preview/__init__.py | 13 +- .../_container_service_client.py | 8 +- .../v2018_08_01_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 8 +- .../aio/operations/__init__.py | 5 + .../_managed_clusters_operations.py | 376 ++++-- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + .../v2018_08_01_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 15 +- .../v2018_08_01_preview/models/_models_py3.py | 142 +-- .../v2018_08_01_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../_managed_clusters_operations.py | 598 ++++++---- .../operations/_operations.py | 67 +- .../v2018_08_01_preview/operations/_patch.py | 19 + .../v2018_09_30_preview/__init__.py | 13 +- .../_container_service_client.py | 4 +- .../v2018_09_30_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 4 +- .../aio/operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 220 ++-- .../aio/operations/_patch.py | 19 + .../v2018_09_30_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 7 +- .../v2018_09_30_preview/models/_models_py3.py | 58 +- .../v2018_09_30_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 337 +++--- .../v2018_09_30_preview/operations/_patch.py | 19 + .../containerservice/v2019_02_01/__init__.py | 13 +- .../v2019_02_01/_container_service_client.py | 12 +- .../v2019_02_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2019_02_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 152 ++- .../_managed_clusters_operations.py | 376 ++++-- .../v2019_02_01/aio/operations/_operations.py | 48 +- .../v2019_02_01/aio/operations/_patch.py | 19 + .../v2019_02_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 15 +- .../v2019_02_01/models/_models_py3.py | 208 ++-- .../v2019_02_01/models/_patch.py | 19 + .../v2019_02_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 229 ++-- .../_managed_clusters_operations.py | 607 ++++++---- .../v2019_02_01/operations/_operations.py | 67 +- .../v2019_02_01/operations/_patch.py | 19 + .../containerservice/v2019_04_01/__init__.py | 13 +- .../v2019_04_01/_container_service_client.py | 12 +- .../v2019_04_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2019_04_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 152 ++- .../_managed_clusters_operations.py | 376 ++++-- .../v2019_04_01/aio/operations/_operations.py | 48 +- .../v2019_04_01/aio/operations/_patch.py | 19 + .../v2019_04_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 19 +- .../v2019_04_01/models/_models_py3.py | 231 ++-- .../v2019_04_01/models/_patch.py | 19 + .../v2019_04_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 229 ++-- .../_managed_clusters_operations.py | 607 ++++++---- .../v2019_04_01/operations/_operations.py | 67 +- .../v2019_04_01/operations/_patch.py | 19 + .../containerservice/v2019_04_30/__init__.py | 13 +- .../v2019_04_30/_container_service_client.py | 4 +- .../v2019_04_30/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 4 +- .../v2019_04_30/aio/operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 220 ++-- .../v2019_04_30/aio/operations/_patch.py | 19 + .../v2019_04_30/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 7 +- .../v2019_04_30/models/_models_py3.py | 58 +- .../v2019_04_30/models/_patch.py | 19 + .../v2019_04_30/operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 337 +++--- .../v2019_04_30/operations/_patch.py | 19 + .../containerservice/v2019_06_01/__init__.py | 13 +- .../v2019_06_01/_container_service_client.py | 12 +- .../v2019_06_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2019_06_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 376 ++++-- .../v2019_06_01/aio/operations/_operations.py | 48 +- .../v2019_06_01/aio/operations/_patch.py | 19 + .../v2019_06_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 23 +- .../v2019_06_01/models/_models_py3.py | 241 ++-- .../v2019_06_01/models/_patch.py | 19 + .../v2019_06_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 607 ++++++---- .../v2019_06_01/operations/_operations.py | 67 +- .../v2019_06_01/operations/_patch.py | 19 + .../containerservice/v2019_08_01/__init__.py | 13 +- .../v2019_08_01/_container_service_client.py | 12 +- .../v2019_08_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2019_08_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 412 ++++--- .../v2019_08_01/aio/operations/_operations.py | 48 +- .../v2019_08_01/aio/operations/_patch.py | 19 + .../v2019_08_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 23 +- .../v2019_08_01/models/_models_py3.py | 257 ++-- .../v2019_08_01/models/_patch.py | 19 + .../v2019_08_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 660 +++++++---- .../v2019_08_01/operations/_operations.py | 67 +- .../v2019_08_01/operations/_patch.py | 19 + .../v2019_09_30_preview/__init__.py | 13 +- .../_container_service_client.py | 4 +- .../v2019_09_30_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 4 +- .../aio/operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 220 ++-- .../aio/operations/_patch.py | 19 + .../v2019_09_30_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 7 +- .../v2019_09_30_preview/models/_models_py3.py | 60 +- .../v2019_09_30_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 337 +++--- .../v2019_09_30_preview/operations/_patch.py | 19 + .../containerservice/v2019_10_01/__init__.py | 13 +- .../v2019_10_01/_container_service_client.py | 12 +- .../v2019_10_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2019_10_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 429 ++++--- .../v2019_10_01/aio/operations/_operations.py | 48 +- .../v2019_10_01/aio/operations/_patch.py | 19 + .../v2019_10_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 23 +- .../v2019_10_01/models/_models_py3.py | 257 ++-- .../v2019_10_01/models/_patch.py | 19 + .../v2019_10_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 694 ++++++----- .../v2019_10_01/operations/_operations.py | 67 +- .../v2019_10_01/operations/_patch.py | 19 + .../v2019_10_27_preview/__init__.py | 13 +- .../_container_service_client.py | 4 +- .../v2019_10_27_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 4 +- .../aio/operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 220 ++-- .../aio/operations/_patch.py | 19 + .../v2019_10_27_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 7 +- .../v2019_10_27_preview/models/_models_py3.py | 56 +- .../v2019_10_27_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + ..._open_shift_managed_clusters_operations.py | 337 +++--- .../v2019_10_27_preview/operations/_patch.py | 19 + .../containerservice/v2019_11_01/__init__.py | 13 +- .../v2019_11_01/_container_service_client.py | 12 +- .../v2019_11_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2019_11_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 429 ++++--- .../v2019_11_01/aio/operations/_operations.py | 48 +- .../v2019_11_01/aio/operations/_patch.py | 19 + .../v2019_11_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 25 +- .../v2019_11_01/models/_models_py3.py | 269 +++-- .../v2019_11_01/models/_patch.py | 19 + .../v2019_11_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 694 ++++++----- .../v2019_11_01/operations/_operations.py | 67 +- .../v2019_11_01/operations/_patch.py | 19 + .../containerservice/v2020_01_01/__init__.py | 13 +- .../v2020_01_01/_container_service_client.py | 12 +- .../v2020_01_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2020_01_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 429 ++++--- .../v2020_01_01/aio/operations/_operations.py | 48 +- .../v2020_01_01/aio/operations/_patch.py | 19 + .../v2020_01_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 25 +- .../v2020_01_01/models/_models_py3.py | 269 +++-- .../v2020_01_01/models/_patch.py | 19 + .../v2020_01_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 694 ++++++----- .../v2020_01_01/operations/_operations.py | 67 +- .../v2020_01_01/operations/_patch.py | 19 + .../containerservice/v2020_02_01/__init__.py | 13 +- .../v2020_02_01/_container_service_client.py | 12 +- .../v2020_02_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2020_02_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 429 ++++--- .../v2020_02_01/aio/operations/_operations.py | 48 +- .../v2020_02_01/aio/operations/_patch.py | 19 + .../v2020_02_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 27 +- .../v2020_02_01/models/_models_py3.py | 273 ++--- .../v2020_02_01/models/_patch.py | 19 + .../v2020_02_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 694 ++++++----- .../v2020_02_01/operations/_operations.py | 67 +- .../v2020_02_01/operations/_patch.py | 19 + .../containerservice/v2020_03_01/__init__.py | 13 +- .../v2020_03_01/_container_service_client.py | 12 +- .../v2020_03_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2020_03_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 429 ++++--- .../v2020_03_01/aio/operations/_operations.py | 48 +- .../v2020_03_01/aio/operations/_patch.py | 19 + .../v2020_03_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 33 +- .../v2020_03_01/models/_models_py3.py | 336 +++--- .../v2020_03_01/models/_patch.py | 19 + .../v2020_03_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 694 ++++++----- .../v2020_03_01/operations/_operations.py | 67 +- .../v2020_03_01/operations/_patch.py | 19 + .../containerservice/v2020_04_01/__init__.py | 13 +- .../v2020_04_01/_container_service_client.py | 12 +- .../v2020_04_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 12 +- .../v2020_04_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 429 ++++--- .../v2020_04_01/aio/operations/_operations.py | 48 +- .../v2020_04_01/aio/operations/_patch.py | 19 + .../v2020_04_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 33 +- .../v2020_04_01/models/_models_py3.py | 348 +++--- .../v2020_04_01/models/_patch.py | 19 + .../v2020_04_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 694 ++++++----- .../v2020_04_01/operations/_operations.py | 67 +- .../v2020_04_01/operations/_patch.py | 19 + .../containerservice/v2020_06_01/__init__.py | 13 +- .../v2020_06_01/_container_service_client.py | 16 +- .../v2020_06_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 16 +- .../v2020_06_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 186 +-- .../_managed_clusters_operations.py | 429 ++++--- .../v2020_06_01/aio/operations/_operations.py | 48 +- .../v2020_06_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../v2020_06_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 37 +- .../v2020_06_01/models/_models_py3.py | 367 +++--- .../v2020_06_01/models/_patch.py | 19 + .../v2020_06_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 297 +++-- .../_managed_clusters_operations.py | 694 ++++++----- .../v2020_06_01/operations/_operations.py | 67 +- .../v2020_06_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../containerservice/v2020_07_01/__init__.py | 13 +- .../v2020_07_01/_container_service_client.py | 16 +- .../v2020_07_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 16 +- .../v2020_07_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_managed_clusters_operations.py | 429 ++++--- .../v2020_07_01/aio/operations/_operations.py | 48 +- .../v2020_07_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../v2020_07_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 39 +- .../v2020_07_01/models/_models_py3.py | 373 +++--- .../v2020_07_01/models/_patch.py | 19 + .../v2020_07_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_managed_clusters_operations.py | 694 ++++++----- .../v2020_07_01/operations/_operations.py | 67 +- .../v2020_07_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../containerservice/v2020_09_01/__init__.py | 13 +- .../v2020_09_01/_container_service_client.py | 24 +- .../v2020_09_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 24 +- .../v2020_09_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_managed_clusters_operations.py | 501 +++++--- .../v2020_09_01/aio/operations/_operations.py | 48 +- .../v2020_09_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../v2020_09_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 45 +- .../v2020_09_01/models/_models_py3.py | 415 ++++--- .../v2020_09_01/models/_patch.py | 19 + .../v2020_09_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_managed_clusters_operations.py | 800 ++++++++----- .../v2020_09_01/operations/_operations.py | 67 +- .../v2020_09_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../containerservice/v2020_11_01/__init__.py | 13 +- .../v2020_11_01/_container_service_client.py | 24 +- .../v2020_11_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 24 +- .../v2020_11_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_managed_clusters_operations.py | 501 +++++--- .../v2020_11_01/aio/operations/_operations.py | 48 +- .../v2020_11_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../v2020_11_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 49 +- .../v2020_11_01/models/_models_py3.py | 456 ++++---- .../v2020_11_01/models/_patch.py | 19 + .../v2020_11_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_managed_clusters_operations.py | 800 ++++++++----- .../v2020_11_01/operations/_operations.py | 67 +- .../v2020_11_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../containerservice/v2020_12_01/__init__.py | 13 +- .../v2020_12_01/_container_service_client.py | 28 +- .../v2020_12_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 28 +- .../v2020_12_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 501 +++++--- .../v2020_12_01/aio/operations/_operations.py | 48 +- .../v2020_12_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../v2020_12_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 55 +- .../v2020_12_01/models/_models_py3.py | 508 ++++---- .../v2020_12_01/models/_patch.py | 19 + .../v2020_12_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 800 ++++++++----- .../v2020_12_01/operations/_operations.py | 67 +- .../v2020_12_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../containerservice/v2021_02_01/__init__.py | 13 +- .../v2021_02_01/_container_service_client.py | 28 +- .../v2021_02_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 28 +- .../v2021_02_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 501 +++++--- .../v2021_02_01/aio/operations/_operations.py | 48 +- .../v2021_02_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../v2021_02_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 55 +- .../v2021_02_01/models/_models_py3.py | 508 ++++---- .../v2021_02_01/models/_patch.py | 19 + .../v2021_02_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 800 ++++++++----- .../v2021_02_01/operations/_operations.py | 67 +- .../v2021_02_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../containerservice/v2021_03_01/__init__.py | 13 +- .../v2021_03_01/_container_service_client.py | 28 +- .../v2021_03_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 28 +- .../v2021_03_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 584 ++++++--- .../v2021_03_01/aio/operations/_operations.py | 48 +- .../v2021_03_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../v2021_03_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 61 +- .../v2021_03_01/models/_models_py3.py | 556 +++++---- .../v2021_03_01/models/_patch.py | 19 + .../v2021_03_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 942 +++++++++------ .../v2021_03_01/operations/_operations.py | 67 +- .../v2021_03_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../containerservice/v2021_05_01/__init__.py | 13 +- .../v2021_05_01/_container_service_client.py | 28 +- .../v2021_05_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 28 +- .../v2021_05_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2021_05_01/aio/operations/_operations.py | 48 +- .../v2021_05_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../v2021_05_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 61 +- .../v2021_05_01/models/_models_py3.py | 580 +++++---- .../v2021_05_01/models/_patch.py | 19 + .../v2021_05_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 984 ++++++++++------ .../v2021_05_01/operations/_operations.py | 67 +- .../v2021_05_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../containerservice/v2021_07_01/__init__.py | 13 +- .../v2021_07_01/_container_service_client.py | 28 +- .../v2021_07_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 28 +- .../v2021_07_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2021_07_01/aio/operations/_operations.py | 48 +- .../v2021_07_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../v2021_07_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 63 +- .../v2021_07_01/models/_models_py3.py | 582 +++++---- .../v2021_07_01/models/_patch.py | 19 + .../v2021_07_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 984 ++++++++++------ .../v2021_07_01/operations/_operations.py | 67 +- .../v2021_07_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../containerservice/v2021_08_01/__init__.py | 13 +- .../v2021_08_01/_container_service_client.py | 32 +- .../v2021_08_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../v2021_08_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2021_08_01/aio/operations/_operations.py | 48 +- .../v2021_08_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2021_08_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 69 +- .../v2021_08_01/models/_models_py3.py | 636 +++++----- .../v2021_08_01/models/_patch.py | 19 + .../v2021_08_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 984 ++++++++++------ .../v2021_08_01/operations/_operations.py | 67 +- .../v2021_08_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../containerservice/v2021_09_01/__init__.py | 13 +- .../v2021_09_01/_container_service_client.py | 32 +- .../v2021_09_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../v2021_09_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 227 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2021_09_01/aio/operations/_operations.py | 48 +- .../v2021_09_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2021_09_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 69 +- .../v2021_09_01/models/_models_py3.py | 652 +++++------ .../v2021_09_01/models/_patch.py | 19 + .../v2021_09_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 355 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 984 ++++++++++------ .../v2021_09_01/operations/_operations.py | 67 +- .../v2021_09_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../containerservice/v2021_10_01/__init__.py | 13 +- .../v2021_10_01/_container_service_client.py | 32 +- .../v2021_10_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../v2021_10_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2021_10_01/aio/operations/_operations.py | 48 +- .../v2021_10_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2021_10_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 71 +- .../v2021_10_01/models/_models_py3.py | 658 ++++++----- .../v2021_10_01/models/_patch.py | 19 + .../v2021_10_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 984 ++++++++++------ .../v2021_10_01/operations/_operations.py | 67 +- .../v2021_10_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../v2021_11_01_preview/__init__.py | 13 +- .../_container_service_client.py | 32 +- .../v2021_11_01_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2021_11_01_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 71 +- .../v2021_11_01_preview/models/_models_py3.py | 660 ++++++----- .../v2021_11_01_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 984 ++++++++++------ .../operations/_operations.py | 67 +- .../v2021_11_01_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../containerservice/v2022_01_01/__init__.py | 13 +- .../v2022_01_01/_container_service_client.py | 32 +- .../v2022_01_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../v2022_01_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2022_01_01/aio/operations/_operations.py | 48 +- .../v2022_01_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2022_01_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 73 +- .../v2022_01_01/models/_models_py3.py | 658 ++++++----- .../v2022_01_01/models/_patch.py | 19 + .../v2022_01_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 986 ++++++++++------ .../v2022_01_01/operations/_operations.py | 67 +- .../v2022_01_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../v2022_01_02_preview/__init__.py | 13 +- .../_container_service_client.py | 32 +- .../v2022_01_02_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2022_01_02_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 73 +- .../v2022_01_02_preview/models/_models_py3.py | 660 ++++++----- .../v2022_01_02_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 986 ++++++++++------ .../operations/_operations.py | 67 +- .../v2022_01_02_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../containerservice/v2022_02_01/__init__.py | 13 +- .../v2022_02_01/_container_service_client.py | 32 +- .../v2022_02_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../v2022_02_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2022_02_01/aio/operations/_operations.py | 48 +- .../v2022_02_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2022_02_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 73 +- .../v2022_02_01/models/_models_py3.py | 658 ++++++----- .../v2022_02_01/models/_patch.py | 19 + .../v2022_02_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 986 ++++++++++------ .../v2022_02_01/operations/_operations.py | 67 +- .../v2022_02_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../v2022_02_02_preview/__init__.py | 13 +- .../_container_service_client.py | 36 +- .../v2022_02_02_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 36 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_cluster_snapshots_operations.py | 141 ++- .../_managed_clusters_operations.py | 603 ++++++---- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2022_02_02_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 73 +- .../v2022_02_02_preview/models/_models_py3.py | 710 ++++++----- .../v2022_02_02_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_cluster_snapshots_operations.py | 258 ++-- .../_managed_clusters_operations.py | 986 ++++++++++------ .../operations/_operations.py | 67 +- .../v2022_02_02_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../containerservice/v2022_03_01/__init__.py | 13 +- .../v2022_03_01/_container_service_client.py | 32 +- .../v2022_03_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../v2022_03_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2022_03_01/aio/operations/_operations.py | 48 +- .../v2022_03_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2022_03_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 73 +- .../v2022_03_01/models/_models_py3.py | 664 ++++++----- .../v2022_03_01/models/_patch.py | 19 + .../v2022_03_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 986 ++++++++++------ .../v2022_03_01/operations/_operations.py | 67 +- .../v2022_03_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../v2022_03_02_preview/__init__.py | 13 +- .../_container_service_client.py | 36 +- .../v2022_03_02_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 36 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_cluster_snapshots_operations.py | 141 ++- .../_managed_clusters_operations.py | 639 ++++++---- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2022_03_02_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 73 +- .../v2022_03_02_preview/models/_models_py3.py | 724 ++++++------ .../v2022_03_02_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 356 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_cluster_snapshots_operations.py | 258 ++-- .../_managed_clusters_operations.py | 1041 ++++++++++------- .../operations/_operations.py | 67 +- .../v2022_03_02_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../containerservice/v2022_04_01/__init__.py | 13 +- .../v2022_04_01/_container_service_client.py | 32 +- .../v2022_04_01/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 32 +- .../v2022_04_01/aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_clusters_operations.py | 603 ++++++---- .../v2022_04_01/aio/operations/_operations.py | 48 +- .../v2022_04_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- .../v2022_04_01/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 73 +- .../v2022_04_01/models/_models_py3.py | 666 ++++++----- .../v2022_04_01/models/_patch.py | 19 + .../v2022_04_01/operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 354 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_clusters_operations.py | 986 ++++++++++------ .../v2022_04_01/operations/_operations.py | 67 +- .../v2022_04_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- .../v2022_04_02_preview/__init__.py | 13 +- .../_container_service_client.py | 44 +- .../v2022_04_02_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 44 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_cluster_snapshots_operations.py | 141 ++- .../_managed_clusters_operations.py | 639 ++++++---- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- ...trusted_access_role_bindings_operations.py | 101 +- .../_trusted_access_roles_operations.py | 48 +- .../v2022_04_02_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 77 +- .../v2022_04_02_preview/models/_models_py3.py | 742 ++++++------ .../v2022_04_02_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 356 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_cluster_snapshots_operations.py | 258 ++-- .../_managed_clusters_operations.py | 1041 ++++++++++------- .../operations/_operations.py | 67 +- .../v2022_04_02_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- ...trusted_access_role_bindings_operations.py | 178 +-- .../_trusted_access_roles_operations.py | 67 +- .../v2022_05_02_preview/__init__.py | 13 +- .../_container_service_client.py | 44 +- .../v2022_05_02_preview/aio/__init__.py | 13 +- .../aio/_container_service_client.py | 44 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_agent_pools_operations.py | 226 ++-- .../_maintenance_configurations_operations.py | 101 +- .../_managed_cluster_snapshots_operations.py | 141 ++- .../_managed_clusters_operations.py | 639 ++++++---- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 122 +- .../_private_link_resources_operations.py | 46 +- ...olve_private_link_service_id_operations.py | 50 +- .../aio/operations/_snapshots_operations.py | 141 ++- ...trusted_access_role_bindings_operations.py | 101 +- .../_trusted_access_roles_operations.py | 48 +- .../v2022_05_02_preview/models/__init__.py | 6 +- .../models/_container_service_client_enums.py | 79 +- .../v2022_05_02_preview/models/_models_py3.py | 757 ++++++------ .../v2022_05_02_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_agent_pools_operations.py | 356 +++--- .../_maintenance_configurations_operations.py | 178 +-- .../_managed_cluster_snapshots_operations.py | 258 ++-- .../_managed_clusters_operations.py | 1041 ++++++++++------- .../operations/_operations.py | 67 +- .../v2022_05_02_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 199 ++-- .../_private_link_resources_operations.py | 65 +- ...olve_private_link_service_id_operations.py | 76 +- .../operations/_snapshots_operations.py | 258 ++-- ...trusted_access_role_bindings_operations.py | 178 +-- .../_trusted_access_roles_operations.py | 67 +- 881 files changed, 71347 insertions(+), 46509 deletions(-) create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py diff --git a/sdk/containerservice/azure-mgmt-containerservice/_meta.json b/sdk/containerservice/azure-mgmt-containerservice/_meta.json index a9da08a41ba0e..53794bb5cebcf 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": "9c0f893e5b1f2cdd40c7c4b045e8a6c38393b32c", "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/v2017_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py index 53c675bd95e22..37a5f9e02e6f7 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 8f070e8d6b636..7946cd0a60099 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 53c675bd95e22..37a5f9e02e6f7 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 c3f5db634a792..4dd58f78ab860 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 db0e90a3a5aa0..a96e407a7be15 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 89dc21af553b5..7d2aae2df1aca 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 0000000000000..0ad201a8c586e --- /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 51f3979cb9a3e..22ff2933917b1 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 5d7f0f6cd4c4d..0dc545173c263 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 59476c21795f1..657fa541206de 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 0000000000000..0ad201a8c586e --- /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 db0e90a3a5aa0..a96e407a7be15 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 4b2829a8d5483..cb6bfc4242575 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 340e0ee5f97cb..51eafa3744452 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 53c675bd95e22..37a5f9e02e6f7 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 04156f7e553cb..5abcaf69854c2 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 77613c407d74a..79c2682d6c295 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 0eb46672a07b7..61c25479c93d0 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 9acc332b8a047..607554bc1517b 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 0000000000000..0ad201a8c586e --- /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 f44d371e62f36..1cfef05788b72 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 139990e598ab4..5835a9bfa4b24 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 6bcca5f226525..c548e149a28d4 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 0000000000000..0ad201a8c586e --- /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 77613c407d74a..79c2682d6c295 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 982c27cbf856c..655274ffd5b0a 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 2280e5fc974a8..7241fae07e66c 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 436ce2bb01f8d..03a23e2a1d1b5 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 53c675bd95e22..37a5f9e02e6f7 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 0db31af427ee0..b1847fb3580ce 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 77613c407d74a..79c2682d6c295 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 b3fbbd1e084dd..6b9326e289688 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 2df80a80b010d..d2f89a1a00721 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 0000000000000..0ad201a8c586e --- /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 973922e9e06d9..1ce7f1900a828 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 aa7c375fed858..e5a5445ed6cba 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 09ae71717b3bd..c8a0bdf6f28d3 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 0000000000000..0ad201a8c586e --- /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 77613c407d74a..79c2682d6c295 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 da171d34ee620..c259496701bff 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 ece0f9286c464..e89dac78f5526 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 6bb9a87c53ee7..f5ad4edbd724e 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 53c675bd95e22..37a5f9e02e6f7 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 b1cdc25a9bdc7..a71c11f3d0102 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 45d890441cd5b..211a878798049 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 57f7accb83d21..9504f0d209a45 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 0000000000000..0ad201a8c586e --- /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 35292467d6d1b..421ce777c2597 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 9cff02877c357..6c64f62d06619 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 3fe2805c341a6..d123074129464 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 0000000000000..0ad201a8c586e --- /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 45d890441cd5b..211a878798049 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 c67e3fe4873ad..ed6e6e435ab63 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 39a0402fe1230..f5c7b03bc2840 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 53c675bd95e22..37a5f9e02e6f7 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 bdca43019bbf2..dc20a61d1d5e6 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 5aac40228eec8..403c0174f0520 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 8fb4d4e191c17..bd0017dc9f1f5 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 04533adca394c..97ebd3ac62311 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 c9408d7a4c136..33ab553798206 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 0000000000000..0ad201a8c586e --- /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 438187c216817..5ff60eebf8eca 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 1791a5baa2a66..2fec0b6f593f8 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 ed2f6d738f38e..da614ecc9d399 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 35989f81ecd31..afd7a6264ceea 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 071e179f81c25..47dd44a44974b 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 bbada23db5b55..e39e3d0c3338b 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 90532a7c5b651..01844ee0d562e 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 53c675bd95e22..37a5f9e02e6f7 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 6410da9a87847..fcff601fd1aaa 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 5aac40228eec8..403c0174f0520 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 f5d1c1630d6be..013a2731f8905 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 67e532feaaf41..58979d33fc14d 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 14d566cb830f4..f76846b4a72ac 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 0000000000000..0ad201a8c586e --- /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 c690fe9d4ec5d..182b437fa9dac 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 f6c3f83be327b..0c1e2a74caef3 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 42ce0f45c59b1..1ae97789a100d 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 8e2bb37022ec4..27ac6d600e9b8 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 76af59b03a7db..5ce275d52716e 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 589d3b195af18..e70363671387f 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 7ceadade79092..ec8f09f2259ef 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 53c675bd95e22..37a5f9e02e6f7 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 894614460d5e2..518b6b89f5cde 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 45d890441cd5b..211a878798049 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 d45a894e1d69c..f675bb3916d1b 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 0000000000000..0ad201a8c586e --- /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 35292467d6d1b..421ce777c2597 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 9cff02877c357..6c64f62d06619 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 11b32dca9a0f4..47a7d05afb37e 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 0000000000000..0ad201a8c586e --- /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 45d890441cd5b..211a878798049 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 f424a36729a66..97238bf995159 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 8f433dbb78207..d8a6d42b601a4 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 53c675bd95e22..37a5f9e02e6f7 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 f316472b9ac3e..8f2a9c6ac6e6f 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 5aac40228eec8..403c0174f0520 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 c10c573d5283e..3b525f9ca9b7c 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 14beff5015b8c..76f6f0097da13 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 69e58599f1bf5..9310766c942b5 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 0000000000000..0ad201a8c586e --- /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 8e3cc7d17959a..9f2008f20441c 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 18f038fe5f809..f2a8ca90fcb18 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 9f01e52b14f43..5c0100772ebd6 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 acb50e3fff60d..67e5b285cf7b3 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 649e097085458..ed084edeb284a 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 a93e732455109..9317adca4ae10 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 6556760aeb551..f0970f8e97849 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 53c675bd95e22..37a5f9e02e6f7 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 e1be40c90721f..e0b9eef51ecfd 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 5aac40228eec8..403c0174f0520 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 74b98f1fe5eb8..84a42659ad19a 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 332c546fe2c82..0dea25852d395 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 5f1460cc36328..0ac53c3f7ea16 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 0000000000000..0ad201a8c586e --- /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 2988c4a54d069..f8a486e349738 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 18f038fe5f809..f2a8ca90fcb18 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 33b79a3f7e1ec..dffe8c1ee456e 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 5cbdce13d98c9..28349a6c26fcb 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 55378b8dda073..906e90660d664 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 e015433b83077..b12bfabeffd92 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 0e1f81597fa8f..48ac69cd7556b 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 53c675bd95e22..37a5f9e02e6f7 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 f7e0e11180cbf..521c33f7f2293 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 45d890441cd5b..211a878798049 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 56216ee4e0fcc..8eda2427fa6b0 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 0000000000000..0ad201a8c586e --- /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 8c10ceed15600..9bca41fa8e778 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 9cff02877c357..6c64f62d06619 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 3a48ad8dc9b54..dbdb7f1cac9b2 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 0000000000000..0ad201a8c586e --- /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 45d890441cd5b..211a878798049 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 18330ed8b1fb2..50895b9aec199 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 5f29f6b87e19d..1aa2e31ad5153 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 53c675bd95e22..37a5f9e02e6f7 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 57d44dd0b1232..ae6051baa82c6 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 5aac40228eec8..403c0174f0520 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 9a864c0efb1d2..e0e16c336d867 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 262bf6a908b07..6e0a24de85e80 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 8a5c345d9896e..54530a8e359e3 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 0000000000000..0ad201a8c586e --- /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 2988c4a54d069..f8a486e349738 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 18f038fe5f809..f2a8ca90fcb18 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 7fa8cdbee0ec2..a62cbbe0d0578 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 58db681385340..30d32418184d3 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 1639d2838dd64..e8ebce1fe60d7 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 cfd661f2e3db2..060ec68970582 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 98f5864d6602c..d7398868c55b2 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 53c675bd95e22..37a5f9e02e6f7 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 cf8a06d43bfd7..f3d3fc73f3a70 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 45d890441cd5b..211a878798049 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 75b0a570a89b0..693e6eb1504f7 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 0000000000000..0ad201a8c586e --- /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 4d929cdcbe0b6..7442a585cecda 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 9cff02877c357..6c64f62d06619 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 ba8cce439696d..a758b135ff69c 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 0000000000000..0ad201a8c586e --- /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 45d890441cd5b..211a878798049 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 453bfc1a50799..223e9da532afe 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 8e0bb0e0cb522..1a5b10f975b64 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 53c675bd95e22..37a5f9e02e6f7 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 d478b69e5a953..cb39a642d8125 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 5aac40228eec8..403c0174f0520 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 c26cb081077e3..6954d5aa25cd0 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 6e1af65c21e4c..d61f8af21ee4d 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 3259fbbc7e453..f5c8288f0ab44 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 0000000000000..0ad201a8c586e --- /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 91d2c61fb7831..1a970d9d5e412 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 9e8d4ef7ae7b2..137bd739161ec 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 d8b0682bf358b..21aa796d6e7a1 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 c2e2cbd2d67f0..d2d41d58e55e5 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 71f8633df4ccc..db962d3601314 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 9f81548036048..37606e5d60f12 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 b5c05e32388d2..acd9735116d15 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 53c675bd95e22..37a5f9e02e6f7 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 b6064c1d0c2ca..86ef60fc83464 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 5aac40228eec8..403c0174f0520 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 5d051cfe7628e..4727d9943df1b 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 4f8ba14579738..848351e472fc3 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 71d046783edbe..389ef366ace52 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 0000000000000..0ad201a8c586e --- /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 91d2c61fb7831..1a970d9d5e412 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 9e8d4ef7ae7b2..137bd739161ec 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 8aa8ea840b647..8438ddca33a97 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 04549cc0f748e..10adc78a0b23d 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 82cd21ab80003..02861423438aa 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 da0efd645949a..37be3ae467f64 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 dff2b38e7dcac..f35376cde3d35 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 53c675bd95e22..37a5f9e02e6f7 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 c150418861e22..7db5f15edb2da 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 5aac40228eec8..403c0174f0520 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 c4c397b271c58..88fd6e5a069a3 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 e8e238d828dd0..2ff63228fb1ff 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 f1575b9ddf263..453f193b5b4ad 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 0000000000000..0ad201a8c586e --- /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 776ffc5504cad..d27b03c32a540 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 10d3817c531a4..c85b3fdbf115b 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 ce78eb5a7c4e7..bfec8a5ef9d3d 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 044c2d3e7127a..f49b9a360b15f 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 38f353329d7b5..aa208df218fb2 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 532ea9e3a5a51..c4f8b331e1136 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 2cf71c13c8329..3af0440deec6c 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 53c675bd95e22..37a5f9e02e6f7 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 d45548cced31a..fe38c25df9d15 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 5aac40228eec8..403c0174f0520 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 23f1b04f18359..bb194f88ef352 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 2b49ee75fec82..82a58bc1f3adc 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 cdc9e36ff56f7..73fb21f8242dd 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 0000000000000..0ad201a8c586e --- /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 c087ee137f988..ee6bfbcd2b80e 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 7ec3306282c9e..2b17b2cc88e8c 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 241d8e1ae932c..0cc9cca28ea1d 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 d865bed88cc87..7340d44184729 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 d9264f957add8..e4555d18389a4 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 2d73a6ef9ef08..4a174c2bb327e 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 c197520992100..5453f317a26f9 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 53c675bd95e22..37a5f9e02e6f7 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 3fa14a8ba33f7..fb7557c25e9a8 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 5aac40228eec8..403c0174f0520 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 ef4a0968349a8..897f100993eaa 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 a9902f18feab9..f253c07eccc36 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 0017bbca448d0..75d4196ea8f70 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 0000000000000..0ad201a8c586e --- /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 60aa30eba452f..56476cc49a88a 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 8003b6350d2fe..2d070cb2ffce4 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 340eb7273d6ab..74f512963268b 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 0000000000000..0ad201a8c586e --- /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 5aac40228eec8..403c0174f0520 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 27bf0dd999574..58336626fb9d2 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 c3c0f7b9a8472..3241dd953a65a 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 ee7fd83dbbbf8..8302dbe34877e 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 0000000000000..0ad201a8c586e --- /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 53c675bd95e22..37a5f9e02e6f7 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 7fc0116d3af1b..90ba5f3b43036 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 53c675bd95e22..37a5f9e02e6f7 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 f96c9893c1c73..1654eaafb8e59 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 fdbf34a0f8419..9ef6890a9e036 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 c2fa346920c86..e25792974a427 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 c7614b58ae538..749378b6ae80d 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 1b04f2e87e4a9..221ad62cb953c 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 0000000000000..0ad201a8c586e --- /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 e91846bfc179d..b1c492445c601 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 f1841221e822f..fd094911ee92b 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 bd1e8fe8fe400..a2ea966b17c88 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 5e62a6691607a..2d89a734ab29b 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 0000000000000..0ad201a8c586e --- /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 fdbf34a0f8419..9ef6890a9e036 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 783e51cdf62a3..edb6a6f65953d 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 1989c213adcd3..62bb702f62c88 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 d464074da94a1..7d1a57187b590 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 0000000000000..0ad201a8c586e --- /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 828e4b04672cd..557dbb9336217 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 53c675bd95e22..37a5f9e02e6f7 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 94e74cb3ee2ba..d081c9189e727 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 53c675bd95e22..37a5f9e02e6f7 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 1907763e14e56..6a79a0e958c02 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 fdbf34a0f8419..9ef6890a9e036 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 64b13800b4c75..4db150fe871e8 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 11772b2326172..d8866572d9650 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 e293d181cd493..7b2e40d5c2523 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 0000000000000..0ad201a8c586e --- /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 6c28042dd99ae..622697e7dff46 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 542b46df1acc0..fd24e398e7fa4 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 5afa2e6523a33..28581c645ead4 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 4a7f2f56729d4..d84b26c16881a 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 0000000000000..0ad201a8c586e --- /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 fdbf34a0f8419..9ef6890a9e036 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 3d817f16f1e86..08745b928202f 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 9ff0ae5cae8a5..e2bfc3120ecaa 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 7a972fad7e4ed..4cff3e6c5d1c0 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 0000000000000..0ad201a8c586e --- /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 10eabf744f8ee..3cae8a7f0882c 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 53c675bd95e22..37a5f9e02e6f7 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 400293819c690..4aaa3fd573e29 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 53c675bd95e22..37a5f9e02e6f7 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 b9bdd4e6a9888..221bdc1896d35 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 653c03870023b..eb76d54a688d5 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 16c5055379f51..3a92f26aa0d1c 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 008674fd13d96..b623c811741ad 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 de8353f7322f2..313fba28651cd 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 0000000000000..0ad201a8c586e --- /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 f4bbf06ac680b..175d745992d54 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 524fee5872cf5..d507c5d4248ad 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 5e407b7602301..49ebedef0dd12 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 4b98050fe23e1..2d917ca249da4 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 d99b1f1a529e1..dd728798c2172 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 fed66468b5cba..c544b912e67ea 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 0000000000000..0ad201a8c586e --- /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 653c03870023b..eb76d54a688d5 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 90235ec21426d..5e1f510fa0c80 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 42fa9162380c7..568aaaef03640 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 058bfd92a8746..6fd09a9df09d0 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 0000000000000..0ad201a8c586e --- /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 6c0935f492e97..cf02deff8bcb4 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 95e2d4a880baf..f31e3cc4497f0 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 b41d44eb467d9..fbe88eeffcdad 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 53c675bd95e22..37a5f9e02e6f7 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 42df62738cf27..ea8bfb2a321e3 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 53c675bd95e22..37a5f9e02e6f7 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 2f7095daac25e..30f0b9dadd72a 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 653c03870023b..eb76d54a688d5 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 09f6b2111c86b..8ee57914f1ff9 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 e72bb85f8de40..9d727cd7b5d7a 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 c9e2901934897..833db596b9b37 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 0000000000000..0ad201a8c586e --- /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 b7b4d8d654ed2..8019d0d4876a1 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 0b8d5eb375522..66037b98cc9ff 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 be809cb9c260d..23f1958ae8aef 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 a12fd51d81748..92aee945b85a0 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 c3452f896bfab..8594b1e586067 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 7438ca7e20224..b071690b509ad 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 0000000000000..0ad201a8c586e --- /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 653c03870023b..eb76d54a688d5 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 7d394be7ddfdf..218afacf13740 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 301c7320acd11..59eec46cd15ce 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 555001a1b8912..c52e9624e5115 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 0000000000000..0ad201a8c586e --- /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 8d10a3d618f01..9ecd5d738c595 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 65d8fb359f524..a6d4e0d782ef3 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 27237444a0281..391170934689c 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 53c675bd95e22..37a5f9e02e6f7 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 d27c03e6f7f55..a2548045810c0 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 53c675bd95e22..37a5f9e02e6f7 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 baeef62627c73..3c197000ebe38 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 3942e0ca6a01d..f0e265d9f2f48 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 6faeb5440edde..fa4a7d5d4adfc 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 9c7b7f01b4922..c9cbad2566304 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 6e48edcd30fe1..f79d7b7fb0190 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 6a68e0ffac6ad..a7fc7fcd0629a 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 0000000000000..0ad201a8c586e --- /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 c54b75939d840..095e525d66a89 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 904b46920950c..2c5a8f962f882 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 5ed3333fcd168..dfee2f6625b13 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 9e976fe25bb34..2b519b694a358 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 4188985eff749..4e881844aa0f7 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 6d70c3a3917de..975b312a106b2 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 0000000000000..0ad201a8c586e --- /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 3942e0ca6a01d..f0e265d9f2f48 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 3815e879a3592..fbc8ae77123f1 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 2d865b38947ae..74057e5a7aac1 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 4ebcad30c7f84..293f2c66f7019 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 77ead0a3f49fd..586ba5759e64c 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 0000000000000..0ad201a8c586e --- /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 ab68f8b938467..529f804ca58a5 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 22fa441a21cc3..fd1fb9720e432 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 2315282a23488..462ec3e1c8018 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 53c675bd95e22..37a5f9e02e6f7 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 953e092d6c95b..6573744c0f541 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 53c675bd95e22..37a5f9e02e6f7 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 f5d854616c52f..d82390031685b 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 3942e0ca6a01d..f0e265d9f2f48 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 ed84ace2cc05a..261e85dc56b7f 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 0bc90e203c409..206cda0e4f2af 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 03fa9f16c62e9..d504d2cb2f660 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 f85bf1f2a0ec9..9e0d13c8fa5e3 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 0000000000000..0ad201a8c586e --- /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 23840363fbdee..d012423ce30f5 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 d6ecacc655459..56aa8f5c5a1d6 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 271d5c764d8a8..8b2309b2d73e0 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 9e976fe25bb34..2b519b694a358 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 8c8738579bf09..0f1e6fd4800b4 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 4089e6e9c4830..d2af4c7f68e02 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 0000000000000..0ad201a8c586e --- /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 3942e0ca6a01d..f0e265d9f2f48 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 e6e588f01aaac..e04d0e8a8af4a 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 cf0bdb6fb05c0..88558b9297677 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 481514b3b28b5..7d7efc8074af7 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 3970dbc37575c..0efd52cb8701d 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 0000000000000..0ad201a8c586e --- /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 b2ed90399106a..a3da829e02c7a 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 3558299a1fec8..5ed0f7be72c8c 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 d97fc85473ee2..e7afe109326e4 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 53c675bd95e22..37a5f9e02e6f7 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 94d812b2bb98f..8de79f4178242 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 53c675bd95e22..37a5f9e02e6f7 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 9cc4766dba8d4..165e0e5b603f5 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 3942e0ca6a01d..f0e265d9f2f48 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 90977aae05a2c..7ed3c20823155 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 107d86650eec0..4cbfba2d1ac03 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 fcea5bce9eddf..b118de1e59081 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 fdcf76d1bba07..edeba6417e117 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 0000000000000..0ad201a8c586e --- /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 0c80780465166..8085617aed3b5 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 5db395d76b1b5..f06ce0395869d 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 bbef615e214d1..2ced089f1e5bc 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 a7cefae87175b..3d22d386cb282 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 30ac21518ac24..fa53aa10e3164 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 6bf54ff84d5f1..4b2820cd2ad73 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 0000000000000..0ad201a8c586e --- /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 3942e0ca6a01d..f0e265d9f2f48 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 99fbc9f1fcfbf..7ee26761a1ff9 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 e723a8058b888..fc57769537e78 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 58657a474cbd5..2278935467969 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 4ff0d5abbbb9e..b37f9ff585dfe 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 0000000000000..0ad201a8c586e --- /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 d9d7bce5af67e..3743dd042fa89 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 c989d82716bfc..5cdfea5e3eef2 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 445f6e9c99a0e..755ff16fe08fb 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 53c675bd95e22..37a5f9e02e6f7 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 d1c05fb1b4e1f..675423a21fb22 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 53c675bd95e22..37a5f9e02e6f7 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 ce14ee96b63e9..7b89207043ad2 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 3942e0ca6a01d..f0e265d9f2f48 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 f291dbe940003..501cc85d2df53 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 d049486d2252a..51cd7ea9d64ea 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 b7d265bd86371..6288ec697fbab 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 975b0090603b3..328b4bb77ed0f 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 0000000000000..0ad201a8c586e --- /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 28090c36197b9..962a12681d666 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 ece036469a4d0..9049d235536eb 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 1e24122cf6341..fc8f5bf50aeb0 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 89a1af66110fb..406c73f5c5c8d 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 35b63e2471544..57806c223c4b1 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 5730b3e0f7bd5..81bf7d1d86ef2 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 0000000000000..0ad201a8c586e --- /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 3942e0ca6a01d..f0e265d9f2f48 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 fcf96562a472f..772efaf3cd2cf 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 1aa957f0e773e..c99e6ea5f39ee 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 a3d615aa48809..465c9e0981e47 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 7a0fe8e8e42e9..4a4b89db4298d 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 0000000000000..0ad201a8c586e --- /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 2422f8da789dc..dd426c9386f72 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 a2ce3ab3714f9..865c73d23f26e 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 0c4de1f7444e6..90f710553d081 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 53c675bd95e22..37a5f9e02e6f7 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 a4c9312f3b856..012dd7e2a2c3f 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 53c675bd95e22..37a5f9e02e6f7 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 0084764b8d3d3..4744c95be1f39 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 3942e0ca6a01d..f0e265d9f2f48 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 8b7f97e168596..39ba03d9fa8ef 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 1b712374a9977..e16ec2b6b9b2f 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 8219db655817c..26a3132a0203f 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 eb4371a65590a..1f56b8faa7b10 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 0000000000000..0ad201a8c586e --- /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 73a7ee4bce98a..ac4f47bd67785 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 96d3d506346ef..b2aaec80a485c 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 6798c2df8a897..72c94e17afd3d 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 35d5a286ea52a..6fa1f42d96340 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 da540000be1bf..2954de10e2469 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 6f998aaa0c09b..e3090b44cb1cb 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 0000000000000..0ad201a8c586e --- /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 3942e0ca6a01d..f0e265d9f2f48 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 9537fa082104b..4c8bdf758b1cb 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 f470648bfd4c9..18481c77bffd7 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 812e5c27e7924..1f2ee126f4af2 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 f244de015ddae..52dd4bcc98e88 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 0000000000000..0ad201a8c586e --- /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 c7cce877f10dd..f95d89d994307 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 ed00a089129b1..e0c1dbcdb1143 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 17fa22596defe..85a323a75cc9e 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 53c675bd95e22..37a5f9e02e6f7 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 0b4688cb2c18f..a3cb871d8336f 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 53c675bd95e22..37a5f9e02e6f7 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 c129399799aad..9211f22d2213c 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 5e1e5e72fa59f..e0748876288c7 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 3e16bcfe4e6db..afdc0001f22c1 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 03b8b4b99620c..c3a2a5767fbb3 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 be70ec665a601..c22a95020c9b9 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 05ed9625eb41a..a42042da6dc97 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 0000000000000..0ad201a8c586e --- /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 46314b1a13c5e..e03d5930a1b2c 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 e313f0499505f..ed4805ff59d30 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 8a6ff346571b4..6eed10383efd4 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 15407e897ecde..2042f8feb05a4 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 db5980a4e09ae..c36cee9c95c1b 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 54490bab6467d..ca3b2ccab3e18 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 01bacec5b522f..91b6add021117 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 4680bb0788c21..1a95ffc16d08b 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 3344decc9b58c..cc5b8afdf7da1 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 033ce74d7ba23..ac037a8d73f95 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 9ded176c1347b..c4b2bd11ec2c6 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 0000000000000..0ad201a8c586e --- /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 52d12bfd5ecdb..fe0a196e3d2b2 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 16293540827af..4a007d8ee85ef 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 f01ca741e9ac4..43970231f11f5 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 97b0948a837fa..f43d362a50950 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 53c675bd95e22..37a5f9e02e6f7 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 52f287830dad3..43c1504691b80 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 53c675bd95e22..37a5f9e02e6f7 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 e5093b9aca0aa..97f6400f06882 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 5e1e5e72fa59f..e0748876288c7 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 9eda401c9a443..cfdcdb4254474 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 1fa9bc47c899e..402d7c501a2b0 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 4051a70698894..b65314b3786ed 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 a9545fe29aab9..8a491c2c85132 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 0000000000000..0ad201a8c586e --- /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 b91ce6387d516..d8ebc73c6f1c4 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 4f2f2075365a8..9d376ffb96ddb 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 82e286f0ec962..fa46de6674f28 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 68054db92a65c..f12eb8ca42593 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 7efcc102cc76a..a55c620d28042 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 54490bab6467d..ca3b2ccab3e18 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 f255a30154734..ca71353911dca 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 e0996cddbe622..8560b3444a524 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 963a5f22c36f8..b5260990fe12b 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 9098c34901509..55a1ad3df2174 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 f6d02b685927a..dddb70e5a3eb2 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 0000000000000..0ad201a8c586e --- /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 a5abd5905bbfd..4a575d3d6d955 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 0340c20a11889..72ed10d132a30 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 787ab0114b099..d6875eee7e030 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 2799573527f8a..e4b966ca49f37 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 53c675bd95e22..37a5f9e02e6f7 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 a8028d6c8496a..4d30edae83296 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 53c675bd95e22..37a5f9e02e6f7 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 b47c1993747f7..811733b02e202 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 5e1e5e72fa59f..e0748876288c7 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 b344af96b5f54..562f9ae8f3b34 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 1d469266b93b8..dd6b0cdc6d5a6 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 93ec34df3a429..580fdff286e7a 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 19e288c18f552..9e3a9116160ff 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 0000000000000..0ad201a8c586e --- /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 e3a3f29718e77..80479203b6500 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 9082e1ff43887..02136afd64ab6 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 dee25f6266f30..8e6150f50c7b1 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 b2185b10dec67..b476220190d38 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 641f278c0c33d..ffb280a7c2fe1 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 feacacdf3147e..145f90c5ecca5 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 74436df3af1d8..b86bf3087f769 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 661aad09e4480..993f4cee3cf50 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 c7a6b0b8c85a8..3557282635884 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 15b2cc4dc02d9..2e617aa06dc93 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 91e9ff2e20efb..8f999943a4002 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 0000000000000..0ad201a8c586e --- /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 96579451cd816..26b8d394c6b52 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 874b5c3110984..0ff5e5c92b7dd 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 76a30854b0c3d..248da1b9e55d9 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 1cadb3f0c1623..b97b3d781f76d 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 53c675bd95e22..37a5f9e02e6f7 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 07d41fc88aa54..34843360bf09d 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 53c675bd95e22..37a5f9e02e6f7 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 2727beeda0fdd..f9fbf2dfcc022 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 5e1e5e72fa59f..e0748876288c7 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 19194c445b652..e9c62ee11d84a 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 b4cf4a891a245..32fe791a20bbb 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 a8f5fb8a71112..ab219076d55e7 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 049ea70839111..9be9cf1ca2fc5 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 0000000000000..0ad201a8c586e --- /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 4931a848e982b..065ee6086726f 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 060b08e058af7..01c9e62a15413 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 ec51c7fb5fcf9..33adceb1f94fe 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 19d5fa6ee6352..e2ec46e2f1c6a 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 4729140ec1d75..a21f3f5141218 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 feacacdf3147e..145f90c5ecca5 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 2f8ad968608ac..da3b220050e94 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 91af019fa3754..9a53fd417dfa2 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 54637bbca5aef..3c94225e5e510 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 7003393f0cef4..5a72d77a0123c 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 eeb65ddb7f168..03d779d1927eb 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 0000000000000..0ad201a8c586e --- /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 0215dd25630ac..73b7045300922 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 5867c45cab911..0a3882908953d 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 5524a1f31289b..0c61f55536501 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 82721ea50396f..0f88e9a37407f 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 53c675bd95e22..37a5f9e02e6f7 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 1e33ea2dbd362..8be30540f524a 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 53c675bd95e22..37a5f9e02e6f7 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 bd3d0758606ec..1e97768716204 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 5e1e5e72fa59f..e0748876288c7 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 e02dd2ef56cce..e03f43a21963d 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 c878bbf5a640f..6fc3f0ac9cc26 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 479254435dd66..822051dbf7ba3 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 51a4a820acce0..52baa8bb6e161 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 0000000000000..0ad201a8c586e --- /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 21f75476a4f50..15492862f170b 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 154838201b58a..122f7c9551dcc 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 4b8de7f5cff85..396223dbee630 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 1488074b6bb51..42212f6f2bfc6 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 ed24d714f8327..1527884a3c861 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 aa3de5ebe54ee..cb066b7fffcc4 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 550d56e7c3549..cc9b8960d47a7 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 eb6cecdc20b59..3bc68ab11bc5f 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 f7f074ea8d2d1..13d2dd4eb5c48 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 e4b94ad80ca7c..9f2703d3d605f 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 324c275ca8e12..64e35650857f2 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 0000000000000..0ad201a8c586e --- /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 6e432c5eabcdb..1669d1ed026cf 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 7f3d54511c210..dc572bd2162be 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 ea7ee9ce1e1dc..b375e02789a0d 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 d7f5477eb2945..529e165a69e88 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 53c675bd95e22..37a5f9e02e6f7 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 cc93039800ce3..1cde299ed11a0 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 53c675bd95e22..37a5f9e02e6f7 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 5b40a31172394..81c680039c930 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 5e1e5e72fa59f..e0748876288c7 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 c6a80d3ef5f22..41ea462ae237b 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 883c3534d225f..a85db6432a032 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 8acfa048e2eb7..0944a8adc4a66 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 a9acf5ace7bd0..729a7a0ed7f62 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 0000000000000..0ad201a8c586e --- /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 1c038e703b819..37a04e1dbf32f 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 3cf80c717fdaa..4b141de3481d1 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 33f6bbcdfcc91..c1458c9b64ec7 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 9cea526bc8ffd..7c30e7a9dffe1 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 293491d020983..7bb54e83b18e6 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 816efef5f65e4..b4ac50d613176 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 f0764c1601a19..15f583a95804e 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 8f86ce2e458b1..f475b7ac16327 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 ea4de102451ef..c253126d89ae7 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 2b633f61e1035..9ac85fbf9349f 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 dc426f32bf20e..baca194ac48bf 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 0000000000000..0ad201a8c586e --- /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 79adbabdcbf43..b627f57674655 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 6eca78ac7e662..32f47842d674b 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 eba78d7c005dd..e68c052e8fe3a 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 ed743fd87c049..e8e5d4d31ae7e 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 53c675bd95e22..37a5f9e02e6f7 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 0a3fadf17251f..536e9ec317ab2 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 53c675bd95e22..37a5f9e02e6f7 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 f1a3bace22832..766f273d7b0c9 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 5e1e5e72fa59f..e0748876288c7 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 e3bdb708ea0e1..afc340cad47d5 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 8fc8f0999d571..44711e0f7b9cd 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 d4e09f103ae05..be5ee6420fcc1 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 be45fc41030e9..e6f8ca5259ae3 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 0000000000000..0ad201a8c586e --- /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 bb0dbbd9245b8..1476dca05cd98 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 b630386cf1841..93e417b01fb83 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 9eff54e79de7c..b108d8b0990f7 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 3236b2af1b4ee..4085de32aac43 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 ed24d714f8327..1527884a3c861 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 aa3de5ebe54ee..cb066b7fffcc4 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 c5f71a2448286..b745288bfa029 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 72c7d1abe5ad2..2c61667fe758f 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 04f6a63b35919..cf5cea6582d8e 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 f57ce92318145..5e6712ae479e2 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 b960662097015..e877fb4797bae 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 0000000000000..0ad201a8c586e --- /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 da44f76d45903..6e9668571059d 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 b9d3e4aa0e87d..9848dc3a74ada 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 22e9deb6ab45a..29b2f4ce75ad4 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 fd67e6c6543a7..eeb59418f0645 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 53c675bd95e22..37a5f9e02e6f7 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 5ce36a1d74a13..2eb0b6d81cdac 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 53c675bd95e22..37a5f9e02e6f7 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 3bc1a1bf9c7d2..87f65111688d1 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 78e2791463edc..d3b41c8a72b02 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 705bf00c6f4a2..8f5df18c0bfff 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 7c339179d6b00..2918677ea9a2f 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 280462f451bae..6b05185e6313b 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 9d86e7fdf50da..12808f72985a3 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 5b943781e83e5..632fa81ac1c5c 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 0000000000000..0ad201a8c586e --- /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 22fa04cf9cf20..8dbe43d887fda 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 07c9fcd642e47..07dc63801af42 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 579dfd85ef238..be0d353c750a6 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 0e89b8167f4b7..4d39003c6ea43 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 992c9c7bd17d9..6b6acf7cb4ef9 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 375009a44e5b2..c66d7c8a922bd 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 27b55c4284ca6..559241ff4796e 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 0000000000000..0ad201a8c586e --- /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 78e2791463edc..d3b41c8a72b02 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 6749a7949d21e..b7a261f108fba 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 44cb450864b0e..3fa1d72240c76 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 a66e127479e42..6b37ecba75ecc 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 13ef573e1cf86..1e6e484add0ae 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 ac09c64094479..14c30c824aa5d 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 0000000000000..0ad201a8c586e --- /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 d9dc425a43e3c..a091e33e7fba5 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 b87c353d50e67..5596b7f7f905a 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 841f4a340d3f0..3098b43e4fd29 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 d522fa5089774..f2afcde095705 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 53c675bd95e22..37a5f9e02e6f7 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 5fe0711ab0569..f38666aef4509 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 53c675bd95e22..37a5f9e02e6f7 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 bf72d275df4a3..3b24b8239d0a3 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 5e1e5e72fa59f..e0748876288c7 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 f12a572241bc3..a1ace665b086b 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 679e41de98c31..8c9a0f3b1c3e2 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 2ea78f7d0c479..1b69708903e9b 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 aeeb6081ae956..504a0380d27c5 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 0000000000000..0ad201a8c586e --- /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 dc6dff7c8e338..17f17333120ad 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 8080093107fcc..d4afa7cc6d00d 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 6400a0b93abfd..a4026a7e560d2 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 3afbc9e5903cb..32e4c7c6f0c47 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 c5035d3c25581..4adc3fedca9d8 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 aa3de5ebe54ee..cb066b7fffcc4 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 4d2dda17be3c0..b501d9885c2ae 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 77fec60f6261f..69d398d709218 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 115f2099e1c16..4d604f8db9f6a 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 639db9871f923..0e5e0f665f157 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 92976ca593438..e8ef73ce612ff 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 0000000000000..0ad201a8c586e --- /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 224393ed5d6fe..d3949ddb21f01 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 e41dae3f88e92..ceac57a34b42a 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 8289504c6e492..6b6e6fa5f1109 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 12949951896e7..557a335d3fc45 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 53c675bd95e22..37a5f9e02e6f7 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 a624368a37576..a1f62cb0b98f5 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 53c675bd95e22..37a5f9e02e6f7 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 fc0df1ed87677..5dd5814523b8c 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 78e2791463edc..d3b41c8a72b02 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 ba7eb4ea286fc..c502cd3cd65c3 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 9100101120b32..a112084f6555e 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 076c98aaf19d9..442aef9fd5cb8 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 116b07fa3d21d..e4fcdbd1ad8d5 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 b988c0eb68930..2b72bd6466009 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 0000000000000..0ad201a8c586e --- /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 740037fbd98f9..dbac1677030bb 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 92225ab4e4599..631fd01d89b2e 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 e91a676f71dbd..75dab2aee1112 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 b89475a2fcd7c..07ad30adbeff5 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 fc2d5e3f64f5a..ebe438d015d2e 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 375009a44e5b2..c66d7c8a922bd 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 dc6df96c3eb32..7a64b04d52865 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 0000000000000..0ad201a8c586e --- /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 78e2791463edc..d3b41c8a72b02 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 973c1ae00bf8a..649b1e6c12365 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 0fd5266084949..d3ecfd996e2c0 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 1abc45b5f22be..aa072a65db36e 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 b56464d42e458..f721f78a7e50c 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 1507ed4d42618..56b23d784276f 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 0000000000000..0ad201a8c586e --- /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 ad0e0a9dd3fcb..de8d0937ecab9 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 efcd8fd17c52d..9543c00a361a2 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 839133650a186..17f4a0fbf4f46 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 2dd1336d05418..80a4e0b21de8d 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 53c675bd95e22..37a5f9e02e6f7 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 5e885c5f66f38..708db451f51c4 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 53c675bd95e22..37a5f9e02e6f7 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 e82ff380faeb2..fe89be0e1a773 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 5e1e5e72fa59f..e0748876288c7 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 7675daa730da1..5c3c124219527 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 0dbec32898fe0..7e403ad8efc14 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 fe53db85f8648..94d52ed0e94dc 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 57dda77d2d85a..15113a29edd97 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 0000000000000..0ad201a8c586e --- /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 b54ee8fb6e29f..2cbedb4fa0bbd 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 b8fe58c50d4b3..7f5ccc87cd719 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 5e368a1d8f27d..29dacfbc6690c 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 11882ad595aaf..575798ae56e46 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 c5035d3c25581..4adc3fedca9d8 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 aa3de5ebe54ee..cb066b7fffcc4 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 fd66fb3cc5aa5..12805013bc254 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 0000000000000..0ad201a8c586e --- /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 5e1e5e72fa59f..e0748876288c7 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 fca852588aeb2..65692ea16221d 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 6ea0430b957ea..8da22a45b0469 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 722b5da5be43a..b626f48287ee5 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 966fcaefe931c..949783cfe7e0d 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 0000000000000..0ad201a8c586e --- /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 6194e00e76eee..1eb92fbe199e0 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 f70054db99d6d..3992b329d04c3 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 df8b076d43965..57538a9648062 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 f022960d7447b..675ca43b97b50 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 53c675bd95e22..37a5f9e02e6f7 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 e4ae8f978eaa5..4ad4c1107c46a 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 53c675bd95e22..37a5f9e02e6f7 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 f9cc430a0ab09..5430478cae156 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 4a9011533682d..fe53dc12e7783 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 b2432a63922f5..02533969c46e4 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 4c2508631d56a..310e5a77185fe 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 586d7b85df05b..8b4c68e3dac59 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 d690ad6c5b88b..3e1362db70c3d 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 7abbc49995dbe..634c0c65a1dc0 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 0000000000000..0ad201a8c586e --- /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 8b3d6aa5a62ba..137b7ad735ce5 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 766ee97a1bea1..848df481de077 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 0937b600ffde4..64b1f87672526 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 5c24b4f40a245..dcf9f55bc0cae 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 8996bd6b92a7d..67bca0b27d664 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 44cd377127204..b722cb095a44a 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 ec5532f3845ef..fd6f4108856bc 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 dbd286e52ca9e..d98ebcc9fce9e 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 627d45d304715..f3c04f1677323 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 0000000000000..0ad201a8c586e --- /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 4a9011533682d..fe53dc12e7783 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 4183b2df75df3..95fb7006fcbee 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 5a36719abd288..f2dfcd31912db 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 07b53c95b43b5..9f8fe79c016ce 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 ab5dc7873cb68..e8fc0359a0479 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 ae18474928326..51b3039b4de20 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 0000000000000..0ad201a8c586e --- /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 12231c75e4e73..3eef39e2c0b5c 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 921a20893467e..574b6151ccff3 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 ceda32643301d..5e4db19ac97b9 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 5b2ae3b1ada48..7a2ad6a46c77e 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 62ffc2dbddc45..b80d4a1670d2a 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 a4813ed26fe88..72a85e2acf373 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 53c675bd95e22..37a5f9e02e6f7 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 581f5960f4347..6042fa3477302 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 53c675bd95e22..37a5f9e02e6f7 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 2ac002c4abef5..d40a94fd59b40 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 4a9011533682d..fe53dc12e7783 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 58eb5e0c8a3a0..882395492affc 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 c01ab9b8ac5c4..a3efb1a317333 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 a9908b9260836..0bef20e9ed839 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 bad1c828b60c0..d0d9752bcfc54 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 553d7a53341a8..ccb4542cde920 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 0000000000000..0ad201a8c586e --- /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 a611ebdb3ea3e..551cff70c37bd 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 0f7454c299707..2e06d0dfd1d4d 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 a3e93408a5e6c..1e3e8f323664b 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 c438ef50f4ecf..9d1d02cad74cb 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 dc8aaaf8d0ccc..6b5d6919ede10 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 559b5abc91fd9..0bf35970aa9ef 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 2db8310cb9f46..a59d889f0f349 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 3e95e5b654096..e7281f8d63cfb 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 c35dcf5c47517..c0eec4bf7f684 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 0000000000000..0ad201a8c586e --- /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 4a9011533682d..fe53dc12e7783 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 93bcb82883a87..010aab4a6335a 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 31ddec90744f4..bf84feb2dba57 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 d59e2206bde8b..493e77e9c5806 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 ddec9e7256a49..c4cd9a5bc9c30 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 f9743e63a5213..45e2408caa0b7 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 0000000000000..0ad201a8c586e --- /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 ee93bba1976e9..c7692bf4ebb11 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 94744bc4bed6f..572317396b701 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 deb0e3b9adb26..51ac6e2983785 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 db4d466c858cc..29025aba01e33 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 519273e6a3ee8..2a390aa1b7694 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 2e8d83c170afb..f0c912c6250fd 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