From 1e16041b4f4d7deee4e0518af7dda2609f1b94b7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 14 Jan 2022 06:26:40 +0000 Subject: [PATCH] CodeGen from PR 17357 in Azure/azure-rest-api-specs Merge dcc12a9fdadcb6631d603c444335851bed9e01fe into c3cf8a3f07a600dc0c5054a41ed48052f747face --- .../azure-mgmt-containerregistry/_meta.json | 10 +- .../mgmt/containerregistry/_configuration.py | 4 +- .../_container_registry_management_client.py | 34 +- .../containerregistry/aio/_configuration.py | 4 +- .../_container_registry_management_client.py | 35 +- .../azure/mgmt/containerregistry/models.py | 4 +- .../containerregistry/v2017_03_01/__init__.py | 9 +- .../v2017_03_01/_configuration.py | 19 +- .../_container_registry_management_client.py | 82 +- .../v2017_03_01/_metadata.json | 21 +- .../containerregistry/v2017_03_01/_patch.py | 31 + .../containerregistry/v2017_03_01/_vendor.py | 27 + .../containerregistry/v2017_03_01/_version.py | 2 +- .../v2017_03_01/aio/__init__.py | 5 + .../v2017_03_01/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 73 +- .../v2017_03_01/aio/_patch.py | 31 + .../v2017_03_01/aio/operations/_operations.py | 45 +- .../aio/operations/_registries_operations.py | 386 +- .../v2017_03_01/models/__init__.py | 51 +- ...tainer_registry_management_client_enums.py | 25 +- .../v2017_03_01/models/_models.py | 523 --- .../v2017_03_01/models/_models_py3.py | 278 +- .../v2017_03_01/operations/_operations.py | 86 +- .../operations/_registries_operations.py | 820 ++-- .../containerregistry/v2017_10_01/__init__.py | 9 +- .../v2017_10_01/_configuration.py | 19 +- .../_container_registry_management_client.py | 95 +- .../v2017_10_01/_metadata.json | 21 +- .../containerregistry/v2017_10_01/_patch.py | 31 + .../containerregistry/v2017_10_01/_vendor.py | 27 + .../containerregistry/v2017_10_01/_version.py | 2 +- .../v2017_10_01/aio/__init__.py | 5 + .../v2017_10_01/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 84 +- .../v2017_10_01/aio/_patch.py | 31 + .../v2017_10_01/aio/operations/_operations.py | 45 +- .../aio/operations/_registries_operations.py | 633 ++- .../operations/_replications_operations.py | 299 +- .../aio/operations/_webhooks_operations.py | 418 +- .../v2017_10_01/models/__init__.py | 141 +- ...tainer_registry_management_client_enums.py | 43 +- .../v2017_10_01/models/_models.py | 1529 ------- .../v2017_10_01/models/_models_py3.py | 975 +++-- .../v2017_10_01/operations/_operations.py | 86 +- .../operations/_registries_operations.py | 1302 ++++-- .../operations/_replications_operations.py | 600 ++- .../operations/_webhooks_operations.py | 851 ++-- .../v2018_02_01_preview/__init__.py | 9 +- .../v2018_02_01_preview/_configuration.py | 19 +- .../_container_registry_management_client.py | 101 +- .../v2018_02_01_preview/_metadata.json | 21 +- .../v2018_02_01_preview/_patch.py | 31 + .../v2018_02_01_preview/_vendor.py | 27 + .../v2018_02_01_preview/_version.py | 2 +- .../v2018_02_01_preview/aio/__init__.py | 5 + .../v2018_02_01_preview/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 90 +- .../v2018_02_01_preview/aio/_patch.py | 31 + .../aio/operations/_build_steps_operations.py | 369 +- .../aio/operations/_build_tasks_operations.py | 340 +- .../aio/operations/_builds_operations.py | 264 +- .../aio/operations/_registries_operations.py | 107 +- .../v2018_02_01_preview/models/__init__.py | 99 +- ...tainer_registry_management_client_enums.py | 41 +- .../v2018_02_01_preview/models/_models.py | 1254 ------ .../v2018_02_01_preview/models/_models_py3.py | 813 ++-- .../operations/_build_steps_operations.py | 742 ++-- .../operations/_build_tasks_operations.py | 694 ++-- .../operations/_builds_operations.py | 557 ++- .../operations/_registries_operations.py | 230 +- .../containerregistry/v2018_09_01/__init__.py | 9 +- .../v2018_09_01/_configuration.py | 19 +- .../_container_registry_management_client.py | 86 +- .../v2018_09_01/_metadata.json | 21 +- .../containerregistry/v2018_09_01/_patch.py | 31 + .../containerregistry/v2018_09_01/_vendor.py | 27 + .../containerregistry/v2018_09_01/_version.py | 2 +- .../v2018_09_01/aio/__init__.py | 5 + .../v2018_09_01/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 77 +- .../v2018_09_01/aio/_patch.py | 31 + .../aio/operations/_registries_operations.py | 107 +- .../aio/operations/_runs_operations.py | 260 +- .../aio/operations/_tasks_operations.py | 323 +- .../v2018_09_01/models/__init__.py | 144 +- ...tainer_registry_management_client_enums.py | 51 +- .../v2018_09_01/models/_models.py | 1969 --------- .../v2018_09_01/models/_models_py3.py | 1456 +++++-- .../operations/_registries_operations.py | 227 +- .../operations/_runs_operations.py | 545 ++- .../operations/_tasks_operations.py | 666 +-- .../containerregistry/v2019_04_01/__init__.py | 9 +- .../v2019_04_01/_configuration.py | 19 +- .../_container_registry_management_client.py | 86 +- .../v2019_04_01/_metadata.json | 21 +- .../containerregistry/v2019_04_01/_patch.py | 31 + .../containerregistry/v2019_04_01/_vendor.py | 27 + .../containerregistry/v2019_04_01/_version.py | 2 +- .../v2019_04_01/aio/__init__.py | 5 + .../v2019_04_01/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 77 +- .../v2019_04_01/aio/_patch.py | 31 + .../aio/operations/_registries_operations.py | 107 +- .../aio/operations/_runs_operations.py | 260 +- .../aio/operations/_tasks_operations.py | 323 +- .../v2019_04_01/models/__init__.py | 159 +- ...tainer_registry_management_client_enums.py | 53 +- .../v2019_04_01/models/_models.py | 2132 ---------- .../v2019_04_01/models/_models_py3.py | 1652 +++++--- .../operations/_registries_operations.py | 227 +- .../operations/_runs_operations.py | 545 ++- .../operations/_tasks_operations.py | 666 +-- .../containerregistry/v2019_05_01/__init__.py | 9 +- .../v2019_05_01/_configuration.py | 19 +- .../_container_registry_management_client.py | 95 +- .../v2019_05_01/_metadata.json | 21 +- .../containerregistry/v2019_05_01/_patch.py | 31 + .../containerregistry/v2019_05_01/_vendor.py | 27 + .../containerregistry/v2019_05_01/_version.py | 2 +- .../v2019_05_01/aio/__init__.py | 5 + .../v2019_05_01/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 84 +- .../v2019_05_01/aio/_patch.py | 31 + .../v2019_05_01/aio/operations/_operations.py | 45 +- .../aio/operations/_registries_operations.py | 528 ++- .../operations/_replications_operations.py | 299 +- .../aio/operations/_webhooks_operations.py | 418 +- .../v2019_05_01/models/__init__.py | 144 +- ...tainer_registry_management_client_enums.py | 43 +- .../v2019_05_01/models/_models.py | 1569 ------- .../v2019_05_01/models/_models_py3.py | 999 +++-- .../v2019_05_01/operations/_operations.py | 86 +- .../operations/_registries_operations.py | 1087 +++-- .../operations/_replications_operations.py | 600 ++- .../operations/_webhooks_operations.py | 851 ++-- .../v2019_05_01_preview/__init__.py | 9 +- .../v2019_05_01_preview/_configuration.py | 19 +- .../_container_registry_management_client.py | 92 +- .../v2019_05_01_preview/_metadata.json | 21 +- .../v2019_05_01_preview/_patch.py | 31 + .../v2019_05_01_preview/_vendor.py | 27 + .../v2019_05_01_preview/_version.py | 2 +- .../v2019_05_01_preview/aio/__init__.py | 5 + .../v2019_05_01_preview/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 83 +- .../v2019_05_01_preview/aio/_patch.py | 31 + .../aio/operations/_registries_operations.py | 82 +- .../aio/operations/_scope_maps_operations.py | 299 +- .../aio/operations/_tokens_operations.py | 290 +- .../v2019_05_01_preview/models/__init__.py | 45 +- ...tainer_registry_management_client_enums.py | 31 +- .../v2019_05_01_preview/models/_models.py | 499 --- .../v2019_05_01_preview/models/_models_py3.py | 290 +- .../operations/_registries_operations.py | 161 +- .../operations/_scope_maps_operations.py | 594 ++- .../operations/_tokens_operations.py | 591 ++- .../v2019_06_01_preview/__init__.py | 9 +- .../v2019_06_01_preview/_configuration.py | 19 +- .../_container_registry_management_client.py | 105 +- .../v2019_06_01_preview/_metadata.json | 21 +- .../v2019_06_01_preview/_patch.py | 31 + .../v2019_06_01_preview/_vendor.py | 27 + .../v2019_06_01_preview/_version.py | 2 +- .../v2019_06_01_preview/aio/__init__.py | 5 + .../v2019_06_01_preview/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 93 +- .../v2019_06_01_preview/aio/_patch.py | 31 + .../aio/operations/_agent_pools_operations.py | 346 +- .../aio/operations/_registries_operations.py | 112 +- .../aio/operations/_runs_operations.py | 274 +- .../aio/operations/_task_runs_operations.py | 346 +- .../aio/operations/_tasks_operations.py | 340 +- .../v2019_06_01_preview/models/__init__.py | 195 +- ...tainer_registry_management_client_enums.py | 59 +- .../v2019_06_01_preview/models/_models.py | 2713 ------------ .../v2019_06_01_preview/models/_models_py3.py | 2136 +++++++--- .../operations/_agent_pools_operations.py | 695 ++-- .../operations/_registries_operations.py | 235 +- .../operations/_runs_operations.py | 568 ++- .../operations/_task_runs_operations.py | 695 ++-- .../operations/_tasks_operations.py | 695 ++-- .../v2019_12_01_preview/__init__.py | 9 +- .../v2019_12_01_preview/_configuration.py | 19 +- .../_container_registry_management_client.py | 129 +- .../v2019_12_01_preview/_metadata.json | 21 +- .../v2019_12_01_preview/_patch.py | 31 + .../v2019_12_01_preview/_vendor.py | 27 + .../v2019_12_01_preview/_version.py | 2 +- .../v2019_12_01_preview/aio/__init__.py | 5 + .../v2019_12_01_preview/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 117 +- .../v2019_12_01_preview/aio/_patch.py | 31 + .../_export_pipelines_operations.py | 225 +- .../_import_pipelines_operations.py | 225 +- .../aio/operations/_operations.py | 45 +- .../operations/_pipeline_runs_operations.py | 225 +- ...private_endpoint_connections_operations.py | 225 +- .../aio/operations/_registries_operations.py | 584 ++- .../operations/_replications_operations.py | 299 +- .../aio/operations/_webhooks_operations.py | 418 +- .../v2019_12_01_preview/models/__init__.py | 231 +- ...tainer_registry_management_client_enums.py | 69 +- .../v2019_12_01_preview/models/_models.py | 2665 ------------ .../v2019_12_01_preview/models/_models_py3.py | 1725 +++++--- .../_export_pipelines_operations.py | 454 +- .../_import_pipelines_operations.py | 454 +- .../operations/_operations.py | 86 +- .../operations/_pipeline_runs_operations.py | 454 +- ...private_endpoint_connections_operations.py | 454 +- .../operations/_registries_operations.py | 1187 ++++-- .../operations/_replications_operations.py | 600 ++- .../operations/_webhooks_operations.py | 857 ++-- .../v2020_11_01_preview/__init__.py | 9 +- .../v2020_11_01_preview/_configuration.py | 19 +- .../_container_registry_management_client.py | 149 +- .../v2020_11_01_preview/_metadata.json | 21 +- .../v2020_11_01_preview/_patch.py | 31 + .../v2020_11_01_preview/_vendor.py | 27 + .../v2020_11_01_preview/_version.py | 2 +- .../v2020_11_01_preview/aio/__init__.py | 5 + .../v2020_11_01_preview/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 138 +- .../v2020_11_01_preview/aio/_patch.py | 31 + .../_connected_registries_operations.py | 379 +- .../_export_pipelines_operations.py | 225 +- .../_import_pipelines_operations.py | 225 +- .../aio/operations/_operations.py | 45 +- .../operations/_pipeline_runs_operations.py | 225 +- ...private_endpoint_connections_operations.py | 225 +- .../aio/operations/_registries_operations.py | 658 ++- .../operations/_replications_operations.py | 299 +- .../aio/operations/_scope_maps_operations.py | 299 +- .../aio/operations/_tokens_operations.py | 290 +- .../aio/operations/_webhooks_operations.py | 418 +- .../v2020_11_01_preview/models/__init__.py | 312 +- ...tainer_registry_management_client_enums.py | 91 +- .../v2020_11_01_preview/models/_models.py | 3635 ---------------- .../v2020_11_01_preview/models/_models_py3.py | 2225 +++++++--- .../_connected_registries_operations.py | 751 ++-- .../_export_pipelines_operations.py | 454 +- .../_import_pipelines_operations.py | 454 +- .../operations/_operations.py | 86 +- .../operations/_pipeline_runs_operations.py | 454 +- ...private_endpoint_connections_operations.py | 454 +- .../operations/_registries_operations.py | 1327 +++--- .../operations/_replications_operations.py | 600 ++- .../operations/_scope_maps_operations.py | 594 ++- .../operations/_tokens_operations.py | 591 ++- .../operations/_webhooks_operations.py | 857 ++-- .../v2021_06_01_preview/__init__.py | 9 +- .../v2021_06_01_preview/_configuration.py | 19 +- .../_container_registry_management_client.py | 149 +- .../v2021_06_01_preview/_metadata.json | 21 +- .../v2021_06_01_preview/_patch.py | 31 + .../v2021_06_01_preview/_vendor.py | 27 + .../v2021_06_01_preview/_version.py | 2 +- .../v2021_06_01_preview/aio/__init__.py | 5 + .../v2021_06_01_preview/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 138 +- .../v2021_06_01_preview/aio/_patch.py | 31 + .../_connected_registries_operations.py | 379 +- .../_export_pipelines_operations.py | 225 +- .../_import_pipelines_operations.py | 225 +- .../aio/operations/_operations.py | 45 +- .../operations/_pipeline_runs_operations.py | 225 +- ...private_endpoint_connections_operations.py | 225 +- .../aio/operations/_registries_operations.py | 658 ++- .../operations/_replications_operations.py | 299 +- .../aio/operations/_scope_maps_operations.py | 299 +- .../aio/operations/_tokens_operations.py | 290 +- .../aio/operations/_webhooks_operations.py | 418 +- .../v2021_06_01_preview/models/__init__.py | 315 +- ...tainer_registry_management_client_enums.py | 93 +- .../v2021_06_01_preview/models/_models.py | 3666 ---------------- .../v2021_06_01_preview/models/_models_py3.py | 2249 +++++++--- .../_connected_registries_operations.py | 751 ++-- .../_export_pipelines_operations.py | 454 +- .../_import_pipelines_operations.py | 454 +- .../operations/_operations.py | 86 +- .../operations/_pipeline_runs_operations.py | 454 +- ...private_endpoint_connections_operations.py | 454 +- .../operations/_registries_operations.py | 1327 +++--- .../operations/_replications_operations.py | 600 ++- .../operations/_scope_maps_operations.py | 594 ++- .../operations/_tokens_operations.py | 591 ++- .../operations/_webhooks_operations.py | 857 ++-- .../v2021_08_01_preview/__init__.py | 9 +- .../v2021_08_01_preview/_configuration.py | 19 +- .../_container_registry_management_client.py | 149 +- .../v2021_08_01_preview/_metadata.json | 21 +- .../v2021_08_01_preview/_patch.py | 31 + .../v2021_08_01_preview/_vendor.py | 27 + .../v2021_08_01_preview/_version.py | 2 +- .../v2021_08_01_preview/aio/__init__.py | 5 + .../v2021_08_01_preview/aio/_configuration.py | 6 +- .../_container_registry_management_client.py | 138 +- .../v2021_08_01_preview/aio/_patch.py | 31 + .../_connected_registries_operations.py | 379 +- .../_export_pipelines_operations.py | 225 +- .../_import_pipelines_operations.py | 225 +- .../aio/operations/_operations.py | 45 +- .../operations/_pipeline_runs_operations.py | 225 +- ...private_endpoint_connections_operations.py | 225 +- .../aio/operations/_registries_operations.py | 658 ++- .../operations/_replications_operations.py | 299 +- .../aio/operations/_scope_maps_operations.py | 299 +- .../aio/operations/_tokens_operations.py | 290 +- .../aio/operations/_webhooks_operations.py | 418 +- .../v2021_08_01_preview/models/__init__.py | 315 +- ...tainer_registry_management_client_enums.py | 93 +- .../v2021_08_01_preview/models/_models.py | 3676 ----------------- .../v2021_08_01_preview/models/_models_py3.py | 2263 +++++++--- .../_connected_registries_operations.py | 751 ++-- .../_export_pipelines_operations.py | 454 +- .../_import_pipelines_operations.py | 454 +- .../operations/_operations.py | 86 +- .../operations/_pipeline_runs_operations.py | 454 +- ...private_endpoint_connections_operations.py | 454 +- .../operations/_registries_operations.py | 1327 +++--- .../operations/_replications_operations.py | 600 ++- .../operations/_scope_maps_operations.py | 594 ++- .../operations/_tokens_operations.py | 591 ++- .../operations/_webhooks_operations.py | 857 ++-- .../containerregistry/v2021_09_01/__init__.py | 18 + .../v2021_09_01/_configuration.py | 68 + .../_container_registry_management_client.py | 107 + .../v2021_09_01/_metadata.json | 106 + .../containerregistry/v2021_09_01/_patch.py | 31 + .../containerregistry/v2021_09_01/_vendor.py | 27 + .../containerregistry/v2021_09_01/_version.py | 9 + .../v2021_09_01/aio/__init__.py | 15 + .../v2021_09_01/aio/_configuration.py | 67 + .../_container_registry_management_client.py | 105 + .../v2021_09_01/aio/_patch.py | 31 + .../v2021_09_01/aio/operations/__init__.py | 21 + .../v2021_09_01/aio/operations/_operations.py | 109 + ...private_endpoint_connections_operations.py | 414 ++ .../aio/operations/_registries_operations.py | 1040 +++++ .../operations/_replications_operations.py | 541 +++ .../aio/operations/_webhooks_operations.py | 733 ++++ .../v2021_09_01/models/__init__.py | 187 + ...tainer_registry_management_client_enums.py | 182 + .../v2021_09_01/models/_models_py3.py | 3109 ++++++++++++++ .../v2021_09_01/operations/__init__.py | 21 + .../v2021_09_01/operations/_operations.py | 135 + ...private_endpoint_connections_operations.py | 565 +++ .../operations/_registries_operations.py | 1524 +++++++ .../operations/_replications_operations.py | 738 ++++ .../operations/_webhooks_operations.py | 1037 +++++ .../containerregistry/v2021_09_01/py.typed | 1 + 351 files changed, 61531 insertions(+), 59446 deletions(-) create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_patch.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_configuration.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_container_registry_management_client.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_metadata.json create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_vendor.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_version.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_configuration.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_container_registry_management_client.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_patch.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_registries_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_replications_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_webhooks_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_container_registry_management_client_enums.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_models_py3.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_registries_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_replications_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_webhooks_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/py.typed diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json b/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json index f708abaf844f..dc8c16732d7a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "99d3931e458882c3402aad2f971e46e961a1e78c", + "commit": "e9dc2849200de531154b886ff09bf40da25fd172", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/containerregistry/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/containerregistry/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/containerregistry/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py index 3a941811968b..8ab432d3a36a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py index 756fc3e017ad..da3f6fe4e19e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py @@ -23,7 +23,6 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -56,16 +55,24 @@ class ContainerRegistryManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2019-05-01' + DEFAULT_API_VERSION = '2021-09-01' _PROFILE_TAG = "azure.mgmt.containerregistry.ContainerRegistryManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'agent_pools': '2019-06-01-preview', 'build_steps': '2018-02-01-preview', 'build_tasks': '2018-02-01-preview', 'builds': '2018-02-01-preview', + 'connected_registries': '2021-08-01-preview', + 'export_pipelines': '2021-08-01-preview', + 'import_pipelines': '2021-08-01-preview', + 'pipeline_runs': '2021-08-01-preview', 'runs': '2019-04-01', + 'scope_maps': '2021-08-01-preview', + 'task_runs': '2019-06-01-preview', 'tasks': '2019-04-01', + 'tokens': '2021-08-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -75,12 +82,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - if not base_url: - base_url = 'https://management.azure.com' self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(ContainerRegistryManagementClient, self).__init__( @@ -108,6 +113,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-08-01-preview: :mod:`v2021_08_01_preview.models` + * 2021-09-01: :mod:`v2021_09_01.models` """ if api_version == '2017-03-01': from .v2017_03_01 import models @@ -145,6 +151,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-08-01-preview': from .v2021_08_01_preview import models return models + elif api_version == '2021-09-01': + from .v2021_09_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -273,6 +282,7 @@ def operations(self): * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-08-01-preview: :class:`Operations` + * 2021-09-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-03-01': @@ -289,6 +299,8 @@ def operations(self): from .v2021_06_01_preview.operations import Operations as OperationClass elif api_version == '2021-08-01-preview': from .v2021_08_01_preview.operations import Operations as OperationClass + elif api_version == '2021-09-01': + from .v2021_09_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -323,6 +335,7 @@ def private_endpoint_connections(self): * 2020-11-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-08-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-09-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-12-01-preview': @@ -333,6 +346,8 @@ def private_endpoint_connections(self): from .v2021_06_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-08-01-preview': from .v2021_08_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-09-01': + from .v2021_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -353,6 +368,7 @@ def registries(self): * 2020-11-01-preview: :class:`RegistriesOperations` * 2021-06-01-preview: :class:`RegistriesOperations` * 2021-08-01-preview: :class:`RegistriesOperations` + * 2021-09-01: :class:`RegistriesOperations` """ api_version = self._get_api_version('registries') if api_version == '2017-03-01': @@ -379,6 +395,8 @@ def registries(self): from .v2021_06_01_preview.operations import RegistriesOperations as OperationClass elif api_version == '2021-08-01-preview': from .v2021_08_01_preview.operations import RegistriesOperations as OperationClass + elif api_version == '2021-09-01': + from .v2021_09_01.operations import RegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -393,6 +411,7 @@ def replications(self): * 2020-11-01-preview: :class:`ReplicationsOperations` * 2021-06-01-preview: :class:`ReplicationsOperations` * 2021-08-01-preview: :class:`ReplicationsOperations` + * 2021-09-01: :class:`ReplicationsOperations` """ api_version = self._get_api_version('replications') if api_version == '2017-10-01': @@ -407,6 +426,8 @@ def replications(self): from .v2021_06_01_preview.operations import ReplicationsOperations as OperationClass elif api_version == '2021-08-01-preview': from .v2021_08_01_preview.operations import ReplicationsOperations as OperationClass + elif api_version == '2021-09-01': + from .v2021_09_01.operations import ReplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'replications'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -516,6 +537,7 @@ def webhooks(self): * 2020-11-01-preview: :class:`WebhooksOperations` * 2021-06-01-preview: :class:`WebhooksOperations` * 2021-08-01-preview: :class:`WebhooksOperations` + * 2021-09-01: :class:`WebhooksOperations` """ api_version = self._get_api_version('webhooks') if api_version == '2017-10-01': @@ -530,6 +552,8 @@ def webhooks(self): from .v2021_06_01_preview.operations import WebhooksOperations as OperationClass elif api_version == '2021-08-01-preview': from .v2021_08_01_preview.operations import WebhooksOperations as OperationClass + elif api_version == '2021-09-01': + from .v2021_09_01.operations import WebhooksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'webhooks'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_configuration.py index 622660f81c5c..3322771933cc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py index 790fe3f87eec..328f73a0d65e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py @@ -11,7 +11,6 @@ from typing import Any, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -54,16 +54,24 @@ class ContainerRegistryManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2019-05-01' + DEFAULT_API_VERSION = '2021-09-01' _PROFILE_TAG = "azure.mgmt.containerregistry.ContainerRegistryManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'agent_pools': '2019-06-01-preview', 'build_steps': '2018-02-01-preview', 'build_tasks': '2018-02-01-preview', 'builds': '2018-02-01-preview', + 'connected_registries': '2021-08-01-preview', + 'export_pipelines': '2021-08-01-preview', + 'import_pipelines': '2021-08-01-preview', + 'pipeline_runs': '2021-08-01-preview', 'runs': '2019-04-01', + 'scope_maps': '2021-08-01-preview', + 'task_runs': '2019-06-01-preview', 'tasks': '2019-04-01', + 'tokens': '2021-08-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -73,12 +81,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(ContainerRegistryManagementClient, self).__init__( @@ -106,6 +112,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-08-01-preview: :mod:`v2021_08_01_preview.models` + * 2021-09-01: :mod:`v2021_09_01.models` """ if api_version == '2017-03-01': from ..v2017_03_01 import models @@ -143,6 +150,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-08-01-preview': from ..v2021_08_01_preview import models return models + elif api_version == '2021-09-01': + from ..v2021_09_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -271,6 +281,7 @@ def operations(self): * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-08-01-preview: :class:`Operations` + * 2021-09-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-03-01': @@ -287,6 +298,8 @@ def operations(self): from ..v2021_06_01_preview.aio.operations import Operations as OperationClass elif api_version == '2021-08-01-preview': from ..v2021_08_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-09-01': + from ..v2021_09_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -321,6 +334,7 @@ def private_endpoint_connections(self): * 2020-11-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-08-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-09-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-12-01-preview': @@ -331,6 +345,8 @@ def private_endpoint_connections(self): from ..v2021_06_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-08-01-preview': from ..v2021_08_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-09-01': + from ..v2021_09_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -351,6 +367,7 @@ def registries(self): * 2020-11-01-preview: :class:`RegistriesOperations` * 2021-06-01-preview: :class:`RegistriesOperations` * 2021-08-01-preview: :class:`RegistriesOperations` + * 2021-09-01: :class:`RegistriesOperations` """ api_version = self._get_api_version('registries') if api_version == '2017-03-01': @@ -377,6 +394,8 @@ def registries(self): from ..v2021_06_01_preview.aio.operations import RegistriesOperations as OperationClass elif api_version == '2021-08-01-preview': from ..v2021_08_01_preview.aio.operations import RegistriesOperations as OperationClass + elif api_version == '2021-09-01': + from ..v2021_09_01.aio.operations import RegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -391,6 +410,7 @@ def replications(self): * 2020-11-01-preview: :class:`ReplicationsOperations` * 2021-06-01-preview: :class:`ReplicationsOperations` * 2021-08-01-preview: :class:`ReplicationsOperations` + * 2021-09-01: :class:`ReplicationsOperations` """ api_version = self._get_api_version('replications') if api_version == '2017-10-01': @@ -405,6 +425,8 @@ def replications(self): from ..v2021_06_01_preview.aio.operations import ReplicationsOperations as OperationClass elif api_version == '2021-08-01-preview': from ..v2021_08_01_preview.aio.operations import ReplicationsOperations as OperationClass + elif api_version == '2021-09-01': + from ..v2021_09_01.aio.operations import ReplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'replications'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -514,6 +536,7 @@ def webhooks(self): * 2020-11-01-preview: :class:`WebhooksOperations` * 2021-06-01-preview: :class:`WebhooksOperations` * 2021-08-01-preview: :class:`WebhooksOperations` + * 2021-09-01: :class:`WebhooksOperations` """ api_version = self._get_api_version('webhooks') if api_version == '2017-10-01': @@ -528,6 +551,8 @@ def webhooks(self): from ..v2021_06_01_preview.aio.operations import WebhooksOperations as OperationClass elif api_version == '2021-08-01-preview': from ..v2021_08_01_preview.aio.operations import WebhooksOperations as OperationClass + elif api_version == '2021-09-01': + from ..v2021_09_01.aio.operations import WebhooksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'webhooks'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models.py index 42dfb6a2def4..b0897e14d6e1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models.py @@ -6,4 +6,6 @@ # -------------------------------------------------------------------------- from .v2018_02_01_preview.models import * from .v2019_04_01.models import * -from .v2019_05_01.models import * +from .v2019_06_01_preview.models import * +from .v2021_08_01_preview.models import * +from .v2021_09_01.models import * diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_configuration.py index 6e459b678eb7..dc4146a987d5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_container_registry_management_client.py index a65ac4942abe..84b4916f971f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_container_registry_management_client.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, RegistriesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import Operations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations @@ -35,50 +32,55 @@ class ContainerRegistryManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_metadata.json index d5acfeb29600..56f3ff4baa23 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "registries": "RegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_configuration.py index 71ce29c9076d..24e2b47a0376 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_container_registry_management_client.py index dda33d257efe..afe5096b9467 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_container_registry_management_client.py @@ -6,75 +6,82 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, RegistriesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import Operations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2017_03_01.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2017_03_01.aio.operations.RegistriesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2017_03_01.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_operations.py index 85e8bf9df2ea..86ed253926e2 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_registries_operations.py index 40bc1d0160f7..38c0775205f5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/aio/operations/_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_credentials_request, build_list_request, build_regenerate_credential_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, registry_name_check_request: "_models.RegistryNameCheckRequest", @@ -53,7 +59,8 @@ async def check_name_availability( :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryNameStatus @@ -64,30 +71,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +98,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -126,27 +126,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -160,8 +150,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -174,32 +166,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_create_parameters, 'RegistryCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_create_parameters, 'RegistryCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -215,8 +197,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -232,18 +217,24 @@ async def begin_create( :param registry_name: The name of the container registry. :type registry_name: str :param registry_create_parameters: The parameters for creating a container registry. - :type registry_create_parameters: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryCreateParameters + :type registry_create_parameters: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -255,27 +246,21 @@ async def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry_create_parameters=registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -287,8 +272,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -312,25 +299,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -343,6 +322,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -358,7 +339,8 @@ async def update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Registry, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_03_01.models.Registry @@ -369,32 +351,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -408,8 +380,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -422,7 +397,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -430,35 +406,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -476,11 +448,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -489,7 +463,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -497,34 +472,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -542,11 +512,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace_async async def list_credentials( self, resource_group_name: str, @@ -570,27 +542,17 @@ async def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,8 +566,11 @@ async def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace_async async def regenerate_credential( self, resource_group_name: str, @@ -622,7 +587,8 @@ async def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2017_03_01.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListCredentialsResult @@ -633,32 +599,22 @@ async def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -672,4 +628,6 @@ async def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/__init__.py index 7e861acea6c6..92c134f35e8b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/__init__.py @@ -6,40 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import OperationDefinition - from ._models_py3 import OperationDisplayDefinition - from ._models_py3 import OperationListResult - from ._models_py3 import RegenerateCredentialParameters - from ._models_py3 import Registry - from ._models_py3 import RegistryCreateParameters - from ._models_py3 import RegistryListCredentialsResult - from ._models_py3 import RegistryListResult - from ._models_py3 import RegistryNameCheckRequest - from ._models_py3 import RegistryNameStatus - from ._models_py3 import RegistryPassword - from ._models_py3 import RegistryUpdateParameters - from ._models_py3 import Resource - from ._models_py3 import Sku - from ._models_py3 import StorageAccountParameters - from ._models_py3 import StorageAccountProperties -except (SyntaxError, ImportError): - from ._models import OperationDefinition # type: ignore - from ._models import OperationDisplayDefinition # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import RegenerateCredentialParameters # type: ignore - from ._models import Registry # type: ignore - from ._models import RegistryCreateParameters # type: ignore - from ._models import RegistryListCredentialsResult # type: ignore - from ._models import RegistryListResult # type: ignore - from ._models import RegistryNameCheckRequest # type: ignore - from ._models import RegistryNameStatus # type: ignore - from ._models import RegistryPassword # type: ignore - from ._models import RegistryUpdateParameters # type: ignore - from ._models import Resource # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccountParameters # type: ignore - from ._models import StorageAccountProperties # type: ignore +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryCreateParameters +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import StorageAccountParameters +from ._models_py3 import StorageAccountProperties + from ._container_registry_management_client_enums import ( PasswordName, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_container_registry_management_client_enums.py index fe7d3efbc2e7..2ddbaa20680c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_container_registry_management_client_enums.py @@ -6,41 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name. """ PASSWORD = "password" PASSWORD2 = "password2" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the container registry at the time the operation was called. """ CREATING = "Creating" SUCCEEDED = "Succeeded" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier based on the SKU name. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py deleted file mode 100644 index 37adc6c774c3..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py +++ /dev/null @@ -1,523 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class OperationDefinition(msrest.serialization.Model): - """The definition of a container registry operation. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: ~azure.mgmt.containerregistry.v2017_03_01.models.OperationDisplayDefinition - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - - -class OperationDisplayDefinition(msrest.serialization.Model): - """The display information for a container registry operation. - - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The result of a request to list container registry operations. - - :param value: The list of container registry operations. Since this list may be incomplete, the - nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2017_03_01.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry - operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegenerateCredentialParameters(msrest.serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateCredentialParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class Registry(Resource): - """An object that represents a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku - :ivar login_server: The URL that can be used to log into the container registry. - :vartype login_server: str - :ivar creation_date: The creation date of the container registry in ISO8601 format. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the container registry at the time the - operation was called. Possible values include: "Creating", "Succeeded". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2017_03_01.models.ProvisioningState - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The properties of the storage account for the container registry. - :type storage_account: - ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'login_server': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Registry, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.login_server = None - self.creation_date = None - self.provisioning_state = None - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.storage_account = kwargs.get('storage_account', None) - - -class RegistryCreateParameters(msrest.serialization.Model): - """The parameters for creating a container registry. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param location: Required. The location of the container registry. This cannot be changed after - the resource is created. - :type location: str - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The parameters of a storage account for the container registry. If - specified, the storage account must be in the same physical location as the container registry. - :type storage_account: - ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountParameters - """ - - _validation = { - 'location': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.sku = kwargs['sku'] - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.storage_account = kwargs.get('storage_account', None) - - -class RegistryListCredentialsResult(msrest.serialization.Model): - """The response from the ListCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class RegistryListResult(msrest.serialization.Model): - """The result of a request to list container registries. - - :param value: The list of container registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Registry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegistryNameCheckRequest(msrest.serialization.Model): - """A request to check whether a container registry name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the container registry. - :type name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Has constant value: - "Microsoft.ContainerRegistry/registries". - :vartype type: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - **kwargs - ): - super(RegistryNameCheckRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class RegistryNameStatus(msrest.serialization.Model): - """The result of a request to check the availability of a container registry name. - - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryNameStatus, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class RegistryPassword(msrest.serialization.Model): - """The login password for the container registry. - - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName - :param value: The password value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPassword, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class RegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a container registry. - - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The parameters of a storage account for the container registry. If - specified, the storage account must be in the same physical location as the container registry. - :type storage_account: - ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountParameters - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.admin_user_enabled = kwargs.get('admin_user_enabled', None) - self.storage_account = kwargs.get('storage_account', None) - - -class Sku(msrest.serialization.Model): - """The SKU of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name of the container registry. Required for registry creation. - Allowed value: Basic. - :type name: str - :ivar tier: The SKU tier based on the SKU name. Possible values include: "Basic". - :vartype tier: str or ~azure.mgmt.containerregistry.v2017_03_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class StorageAccountParameters(msrest.serialization.Model): - """The parameters of a storage account for a container registry. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the storage account. - :type name: str - :param access_key: Required. The access key to the storage account. - :type access_key: str - """ - - _validation = { - 'name': {'required': True}, - 'access_key': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.access_key = kwargs['access_key'] - - -class StorageAccountProperties(msrest.serialization.Model): - """The properties of a storage account for a container registry. - - :param name: The name of the storage account. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py index 072ccedef154..e97ee1fd8dfc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py @@ -16,10 +16,10 @@ class OperationDefinition(msrest.serialization.Model): """The definition of a container registry operation. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: ~azure.mgmt.containerregistry.v2017_03_01.models.OperationDisplayDefinition + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2017_03_01.models.OperationDisplayDefinition """ _attribute_map = { @@ -34,6 +34,12 @@ def __init__( display: Optional["OperationDisplayDefinition"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: ~azure.mgmt.containerregistry.v2017_03_01.models.OperationDisplayDefinition + """ super(OperationDefinition, self).__init__(**kwargs) self.name = name self.display = display @@ -42,14 +48,14 @@ def __init__( class OperationDisplayDefinition(msrest.serialization.Model): """The display information for a container registry operation. - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str """ _attribute_map = { @@ -68,6 +74,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ super(OperationDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -78,12 +94,12 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The result of a request to list container registry operations. - :param value: The list of container registry operations. Since this list may be incomplete, the + :ivar value: The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2017_03_01.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry + :vartype value: list[~azure.mgmt.containerregistry.v2017_03_01.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry operations. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -98,6 +114,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_03_01.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -108,9 +132,9 @@ class RegenerateCredentialParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName """ _validation = { @@ -127,6 +151,11 @@ def __init__( name: Union[str, "PasswordName"], **kwargs ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName + """ super(RegenerateCredentialParameters, self).__init__(**kwargs) self.name = name @@ -144,11 +173,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -173,6 +202,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -194,13 +230,13 @@ class Registry(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku :ivar login_server: The URL that can be used to log into the container registry. :vartype login_server: str :ivar creation_date: The creation date of the container registry in ISO8601 format. @@ -209,10 +245,10 @@ class Registry(Resource): operation was called. Possible values include: "Creating", "Succeeded". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2017_03_01.models.ProvisioningState - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The properties of the storage account for the container registry. - :type storage_account: + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar storage_account: The properties of the storage account for the container registry. + :vartype storage_account: ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountProperties """ @@ -251,6 +287,20 @@ def __init__( storage_account: Optional["StorageAccountProperties"] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword storage_account: The properties of the storage account for the container registry. + :paramtype storage_account: + ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountProperties + """ super(Registry, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.login_server = None @@ -265,18 +315,18 @@ class RegistryCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param location: Required. The location of the container registry. This cannot be changed after + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the container registry. This cannot be changed after the resource is created. - :type location: str - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The parameters of a storage account for the container registry. If + :vartype location: str + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar storage_account: The parameters of a storage account for the container registry. If specified, the storage account must be in the same physical location as the container registry. - :type storage_account: + :vartype storage_account: ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountParameters """ @@ -303,6 +353,21 @@ def __init__( storage_account: Optional["StorageAccountParameters"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the container registry. This cannot be changed + after the resource is created. + :paramtype location: str + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2017_03_01.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword storage_account: The parameters of a storage account for the container registry. If + specified, the storage account must be in the same physical location as the container registry. + :paramtype storage_account: + ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountParameters + """ super(RegistryCreateParameters, self).__init__(**kwargs) self.tags = tags self.location = location @@ -314,10 +379,10 @@ def __init__( class RegistryListCredentialsResult(msrest.serialization.Model): """The response from the ListCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryPassword] + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryPassword] """ _attribute_map = { @@ -332,6 +397,12 @@ def __init__( passwords: Optional[List["RegistryPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: list[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryPassword] + """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -340,11 +411,11 @@ def __init__( class RegistryListResult(msrest.serialization.Model): """The result of a request to list container registries. - :param value: The list of container registries. Since this list may be incomplete, the nextLink + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str """ _attribute_map = { @@ -359,6 +430,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ super(RegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -371,8 +449,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the container registry. - :type name: str + :ivar name: Required. The name of the container registry. + :vartype name: str :ivar type: The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". @@ -397,6 +475,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ super(RegistryNameCheckRequest, self).__init__(**kwargs) self.name = name @@ -404,13 +486,13 @@ def __init__( class RegistryNameStatus(msrest.serialization.Model): """The result of a request to check the availability of a container registry name. - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str """ _attribute_map = { @@ -427,6 +509,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ super(RegistryNameStatus, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -436,10 +527,10 @@ def __init__( class RegistryPassword(msrest.serialization.Model): """The login password for the container registry. - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName - :param value: The password value. - :type value: str + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName + :ivar value: The password value. + :vartype value: str """ _attribute_map = { @@ -454,6 +545,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2017_03_01.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ super(RegistryPassword, self).__init__(**kwargs) self.name = name self.value = value @@ -462,13 +559,13 @@ def __init__( class RegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a container registry. - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The parameters of a storage account for the container registry. If + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar storage_account: The parameters of a storage account for the container registry. If specified, the storage account must be in the same physical location as the container registry. - :type storage_account: + :vartype storage_account: ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountParameters """ @@ -486,6 +583,16 @@ def __init__( storage_account: Optional["StorageAccountParameters"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword storage_account: The parameters of a storage account for the container registry. If + specified, the storage account must be in the same physical location as the container registry. + :paramtype storage_account: + ~azure.mgmt.containerregistry.v2017_03_01.models.StorageAccountParameters + """ super(RegistryUpdateParameters, self).__init__(**kwargs) self.tags = tags self.admin_user_enabled = admin_user_enabled @@ -499,9 +606,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name of the container registry. Required for registry creation. + :ivar name: Required. The SKU name of the container registry. Required for registry creation. Allowed value: Basic. - :type name: str + :vartype name: str :ivar tier: The SKU tier based on the SKU name. Possible values include: "Basic". :vartype tier: str or ~azure.mgmt.containerregistry.v2017_03_01.models.SkuTier """ @@ -522,6 +629,11 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Allowed value: Basic. + :paramtype name: str + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -532,10 +644,10 @@ class StorageAccountParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the storage account. - :type name: str - :param access_key: Required. The access key to the storage account. - :type access_key: str + :ivar name: Required. The name of the storage account. + :vartype name: str + :ivar access_key: Required. The access key to the storage account. + :vartype access_key: str """ _validation = { @@ -555,6 +667,12 @@ def __init__( access_key: str, **kwargs ): + """ + :keyword name: Required. The name of the storage account. + :paramtype name: str + :keyword access_key: Required. The access key to the storage account. + :paramtype access_key: str + """ super(StorageAccountParameters, self).__init__(**kwargs) self.name = name self.access_key = access_key @@ -563,8 +681,8 @@ def __init__( class StorageAccountProperties(msrest.serialization.Model): """The properties of a storage account for a container registry. - :param name: The name of the storage account. - :type name: str + :ivar name: The name of the storage account. + :vartype name: str """ _attribute_map = { @@ -577,5 +695,9 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the storage account. + :paramtype name: str + """ super(StorageAccountProperties, self).__init__(**kwargs) self.name = name diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_operations.py index f056cf1513e2..59265cc17dcd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Container Registry REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_registries_operations.py index f7d421ba0b9b..8027e9f99394 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/operations/_registries_operations.py @@ -5,25 +5,363 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -47,18 +385,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - registry_name_check_request, # type: "_models.RegistryNameCheckRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryNameStatus" + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": """Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryNameStatus @@ -69,30 +408,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,15 +435,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": """Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -132,27 +463,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -166,47 +487,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_create_parameters, # type: "_models.RegistryCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_create_parameters: "_models.RegistryCreateParameters", + **kwargs: Any + ) -> Optional["_models.Registry"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Registry"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_create_parameters, 'RegistryCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_create_parameters, 'RegistryCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -222,16 +534,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - registry_create_parameters, # type: "_models.RegistryCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_create_parameters: "_models.RegistryCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -240,18 +554,23 @@ def begin_create( :param registry_name: The name of the container registry. :type registry_name: str :param registry_create_parameters: The parameters for creating a container registry. - :type registry_create_parameters: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryCreateParameters + :type registry_create_parameters: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_03_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,27 +582,21 @@ def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry_create_parameters=registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -295,15 +608,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: """Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -321,25 +635,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -352,14 +658,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": """Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -368,7 +675,8 @@ def update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Registry, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_03_01.models.Registry @@ -379,32 +687,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -418,14 +716,16 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry @@ -433,7 +733,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -441,35 +742,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -487,21 +784,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -509,34 +808,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -554,18 +848,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -583,27 +878,17 @@ def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -617,16 +902,18 @@ def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace def regenerate_credential( self, - resource_group_name, # type: str - registry_name, # type: str - regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -636,7 +923,8 @@ def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2017_03_01.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2017_03_01.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_03_01.models.RegistryListCredentialsResult @@ -647,32 +935,22 @@ def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -686,4 +964,6 @@ def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_configuration.py index 2264104a2bce..2bea1f714519 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_container_registry_management_client.py index c66aed6c5197..b7d5de058dc0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_container_registry_management_client.py @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import Operations -from .operations import ReplicationsOperations -from .operations import WebhooksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations @@ -34,61 +29,65 @@ class ContainerRegistryManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2017_10_01.operations.Operations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2017_10_01.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2017_10_01.operations.ReplicationsOperations :ivar webhooks: WebhooksOperations operations :vartype webhooks: azure.mgmt.containerregistry.v2017_10_01.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_metadata.json index 544446924cf6..4171bf7b4c5e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "registries": "RegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_configuration.py index 4918f2490800..182e2d0c4b3d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_container_registry_management_client.py index 3f126f988687..169e110f4fc5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_container_registry_management_client.py @@ -6,85 +6,89 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import Operations -from .operations import ReplicationsOperations -from .operations import WebhooksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2017_10_01.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2017_10_01.aio.operations.RegistriesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2017_10_01.aio.operations.Operations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2017_10_01.aio.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2017_10_01.aio.operations.ReplicationsOperations :ivar webhooks: WebhooksOperations operations :vartype webhooks: azure.mgmt.containerregistry.v2017_10_01.aio.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_operations.py index 6c995d651253..7a56a343fa46 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_registries_operations.py index 9b429d607ec0..016232f93d16 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_get_request, build_import_image_request_initial, build_list_by_resource_group_request, build_list_credentials_request, build_list_policies_request, build_list_request, build_list_usages_request, build_regenerate_credential_request, build_update_policies_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,30 +60,22 @@ async def _import_image_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImportImageParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -91,6 +88,8 @@ async def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace_async async def begin_import_image( self, resource_group_name: str, @@ -110,15 +109,18 @@ async def begin_import_image( :type parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -130,24 +132,18 @@ async def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -159,8 +155,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace_async async def check_name_availability( self, registry_name_check_request: "_models.RegistryNameCheckRequest", @@ -171,7 +169,8 @@ async def check_name_availability( :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryNameStatus @@ -182,30 +181,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,8 +208,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -244,27 +236,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,8 +260,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -292,32 +276,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -335,8 +309,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -355,15 +332,20 @@ async def begin_create( :type registry: ~azure.mgmt.containerregistry.v2017_10_01.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -375,27 +357,21 @@ async def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,6 +383,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _delete_initial( @@ -420,25 +397,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -451,6 +420,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -466,15 +437,17 @@ async def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -488,21 +461,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,6 +480,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _update_initial( @@ -528,32 +495,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -571,8 +528,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -588,18 +548,24 @@ async def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -611,27 +577,21 @@ async def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -643,8 +603,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -657,7 +619,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -665,35 +628,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -711,11 +670,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -724,7 +685,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -732,34 +694,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -777,11 +734,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace_async async def list_credentials( self, resource_group_name: str, @@ -805,27 +764,17 @@ async def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,8 +788,11 @@ async def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace_async async def regenerate_credential( self, resource_group_name: str, @@ -857,7 +809,8 @@ async def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListCredentialsResult @@ -868,32 +821,22 @@ async def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -907,8 +850,11 @@ async def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace_async async def list_usages( self, resource_group_name: str, @@ -932,27 +878,17 @@ async def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -966,8 +902,11 @@ async def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace_async async def list_policies( self, resource_group_name: str, @@ -991,27 +930,17 @@ async def list_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.list_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_policies_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1025,8 +954,10 @@ async def list_policies( return cls(pipeline_response, deserialized, {}) return deserialized + list_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listPolicies'} # type: ignore + async def _update_policies_initial( self, resource_group_name: str, @@ -1039,32 +970,22 @@ async def _update_policies_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_policies_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_policies_update_parameters, 'RegistryPolicies') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_policies_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_policies_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_policies_update_parameters, 'RegistryPolicies') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1080,8 +1001,11 @@ async def _update_policies_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_policies_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies'} # type: ignore + + @distributed_trace_async async def begin_update_policies( self, resource_group_name: str, @@ -1098,18 +1022,24 @@ async def begin_update_policies( :type registry_name: str :param registry_policies_update_parameters: The parameters for updating policies of a container registry. - :type registry_policies_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies + :type registry_policies_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RegistryPolicies or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RegistryPolicies or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryPolicies"] lro_delay = kwargs.pop( 'polling_interval', @@ -1121,27 +1051,21 @@ async def begin_update_policies( resource_group_name=resource_group_name, registry_name=registry_name, registry_policies_update_parameters=registry_policies_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RegistryPolicies', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1153,4 +1077,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_replications_operations.py index a136e284787b..1b24c2abc721 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_replications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._replications_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,20 @@ async def begin_create( :type replication: ~azure.mgmt.containerregistry.v2017_10_01.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +203,21 @@ async def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +229,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _delete_initial( @@ -254,26 +244,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +268,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +288,17 @@ async def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +313,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +332,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _update_initial( @@ -369,33 +348,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +382,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +405,24 @@ async def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +435,21 @@ async def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -506,8 +479,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_webhooks_operations.py index ad031921724a..50721a58ae3a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/aio/operations/_webhooks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._webhooks_operations import build_create_request_initial, build_delete_request_initial, build_get_callback_config_request, build_get_request, build_list_events_request, build_list_request, build_ping_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.WebhookListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace_async async def ping( self, resource_group_name: str, @@ -593,28 +567,18 @@ async def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +592,11 @@ async def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace_async async def get_callback_config( self, resource_group_name: str, @@ -656,28 +623,18 @@ async def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -691,8 +648,11 @@ async def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, resource_group_name: str, @@ -711,7 +671,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.EventListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -719,37 +680,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -767,6 +726,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/__init__.py index 88a46845a2ed..cd7984ba9fbd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/__init__.py @@ -6,100 +6,53 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Actor - from ._models_py3 import CallbackConfig - from ._models_py3 import Event - from ._models_py3 import EventContent - from ._models_py3 import EventInfo - from ._models_py3 import EventListResult - from ._models_py3 import EventRequestMessage - from ._models_py3 import EventResponseMessage - from ._models_py3 import IPRule - from ._models_py3 import ImportImageParameters - from ._models_py3 import ImportSource - from ._models_py3 import ImportSourceCredentials - from ._models_py3 import NetworkRuleSet - from ._models_py3 import OperationDefinition - from ._models_py3 import OperationDisplayDefinition - from ._models_py3 import OperationListResult - from ._models_py3 import OperationMetricSpecificationDefinition - from ._models_py3 import OperationServiceSpecificationDefinition - from ._models_py3 import QuarantinePolicy - from ._models_py3 import RegenerateCredentialParameters - from ._models_py3 import Registry - from ._models_py3 import RegistryListCredentialsResult - from ._models_py3 import RegistryListResult - from ._models_py3 import RegistryNameCheckRequest - from ._models_py3 import RegistryNameStatus - from ._models_py3 import RegistryPassword - from ._models_py3 import RegistryPolicies - from ._models_py3 import RegistryUpdateParameters - from ._models_py3 import RegistryUsage - from ._models_py3 import RegistryUsageListResult - from ._models_py3 import Replication - from ._models_py3 import ReplicationListResult - from ._models_py3 import ReplicationUpdateParameters - from ._models_py3 import Request - from ._models_py3 import Resource - from ._models_py3 import Sku - from ._models_py3 import Source - from ._models_py3 import Status - from ._models_py3 import StorageAccountProperties - from ._models_py3 import Target - from ._models_py3 import TrustPolicy - from ._models_py3 import VirtualNetworkRule - from ._models_py3 import Webhook - from ._models_py3 import WebhookCreateParameters - from ._models_py3 import WebhookListResult - from ._models_py3 import WebhookUpdateParameters -except (SyntaxError, ImportError): - from ._models import Actor # type: ignore - from ._models import CallbackConfig # type: ignore - from ._models import Event # type: ignore - from ._models import EventContent # type: ignore - from ._models import EventInfo # type: ignore - from ._models import EventListResult # type: ignore - from ._models import EventRequestMessage # type: ignore - from ._models import EventResponseMessage # type: ignore - from ._models import IPRule # type: ignore - from ._models import ImportImageParameters # type: ignore - from ._models import ImportSource # type: ignore - from ._models import ImportSourceCredentials # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import OperationDefinition # type: ignore - from ._models import OperationDisplayDefinition # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationMetricSpecificationDefinition # type: ignore - from ._models import OperationServiceSpecificationDefinition # type: ignore - from ._models import QuarantinePolicy # type: ignore - from ._models import RegenerateCredentialParameters # type: ignore - from ._models import Registry # type: ignore - from ._models import RegistryListCredentialsResult # type: ignore - from ._models import RegistryListResult # type: ignore - from ._models import RegistryNameCheckRequest # type: ignore - from ._models import RegistryNameStatus # type: ignore - from ._models import RegistryPassword # type: ignore - from ._models import RegistryPolicies # type: ignore - from ._models import RegistryUpdateParameters # type: ignore - from ._models import RegistryUsage # type: ignore - from ._models import RegistryUsageListResult # type: ignore - from ._models import Replication # type: ignore - from ._models import ReplicationListResult # type: ignore - from ._models import ReplicationUpdateParameters # type: ignore - from ._models import Request # type: ignore - from ._models import Resource # type: ignore - from ._models import Sku # type: ignore - from ._models import Source # type: ignore - from ._models import Status # type: ignore - from ._models import StorageAccountProperties # type: ignore - from ._models import Target # type: ignore - from ._models import TrustPolicy # type: ignore - from ._models import VirtualNetworkRule # type: ignore - from ._models import Webhook # type: ignore - from ._models import WebhookCreateParameters # type: ignore - from ._models import WebhookListResult # type: ignore - from ._models import WebhookUpdateParameters # type: ignore +from ._models_py3 import Actor +from ._models_py3 import CallbackConfig +from ._models_py3 import Event +from ._models_py3 import EventContent +from ._models_py3 import EventInfo +from ._models_py3 import EventListResult +from ._models_py3 import EventRequestMessage +from ._models_py3 import EventResponseMessage +from ._models_py3 import IPRule +from ._models_py3 import ImportImageParameters +from ._models_py3 import ImportSource +from ._models_py3 import ImportSourceCredentials +from ._models_py3 import NetworkRuleSet +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import OperationMetricSpecificationDefinition +from ._models_py3 import OperationServiceSpecificationDefinition +from ._models_py3 import QuarantinePolicy +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryPolicies +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import RegistryUsage +from ._models_py3 import RegistryUsageListResult +from ._models_py3 import Replication +from ._models_py3 import ReplicationListResult +from ._models_py3 import ReplicationUpdateParameters +from ._models_py3 import Request +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import Source +from ._models_py3 import Status +from ._models_py3 import StorageAccountProperties +from ._models_py3 import Target +from ._models_py3 import TrustPolicy +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import Webhook +from ._models_py3 import WebhookCreateParameters +from ._models_py3 import WebhookListResult +from ._models_py3 import WebhookUpdateParameters + from ._container_registry_management_client_enums import ( Action, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_container_registry_management_client_enums.py index a0f2407c640c..58c12bf3e36f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_container_registry_management_client_enums.py @@ -6,40 +6,25 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Action(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action of virtual network rule. """ ALLOW = "Allow" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImportMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. """ @@ -47,21 +32,21 @@ class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NO_FORCE = "NoForce" FORCE = "Force" -class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name. """ PASSWORD = "password" PASSWORD2 = "password2" -class PolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the container registry at the time the operation was called. """ @@ -72,14 +57,14 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class RegistryUsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegistryUsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement. """ COUNT = "Count" BYTES = "Bytes" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name of the container registry. Required for registry creation. """ @@ -88,7 +73,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier based on the SKU name. """ @@ -97,13 +82,13 @@ class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TrustPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrustPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of trust policy. """ NOTARY = "Notary" -class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PUSH = "push" DELETE = "delete" @@ -111,7 +96,7 @@ class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CHART_PUSH = "chart_push" CHART_DELETE = "chart_delete" -class WebhookStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the webhook at the time the operation was called. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py deleted file mode 100644 index 5256c6fe6341..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py +++ /dev/null @@ -1,1529 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Actor(msrest.serialization.Model): - """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - - :param name: The subject or username associated with the request context that generated the - event. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Actor, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class CallbackConfig(msrest.serialization.Model): - """The configuration of service URI and custom headers for the webhook. - - All required parameters must be populated in order to send to Azure. - - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - """ - - _validation = { - 'service_uri': {'required': True}, - } - - _attribute_map = { - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(CallbackConfig, self).__init__(**kwargs) - self.service_uri = kwargs['service_uri'] - self.custom_headers = kwargs.get('custom_headers', None) - - -class EventInfo(msrest.serialization.Model): - """The basic information of an event. - - :param id: The event ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventInfo, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Event(EventInfo): - """The event for a webhook. - - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: - ~azure.mgmt.containerregistry.v2017_10_01.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: - ~azure.mgmt.containerregistry.v2017_10_01.models.EventResponseMessage - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, - 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.event_request_message = kwargs.get('event_request_message', None) - self.event_response_message = kwargs.get('event_response_message', None) - - -class EventContent(msrest.serialization.Model): - """The content of the event request message. - - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2017_10_01.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2017_10_01.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the - authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2017_10_01.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor - initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2017_10_01.models.Source - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'action': {'key': 'action', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'Target'}, - 'request': {'key': 'request', 'type': 'Request'}, - 'actor': {'key': 'actor', 'type': 'Actor'}, - 'source': {'key': 'source', 'type': 'Source'}, - } - - def __init__( - self, - **kwargs - ): - super(EventContent, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.action = kwargs.get('action', None) - self.target = kwargs.get('target', None) - self.request = kwargs.get('request', None) - self.actor = kwargs.get('actor', None) - self.source = kwargs.get('source', None) - - -class EventListResult(msrest.serialization.Model): - """The result of a request to list events for a webhook. - - :param value: The list of events. Since this list may be incomplete, the nextLink field should - be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventRequestMessage(msrest.serialization.Model): - """The event request message sent to the service URI. - - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2017_10_01.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'EventContent'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'method': {'key': 'method', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventRequestMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.method = kwargs.get('method', None) - self.request_uri = kwargs.get('request_uri', None) - self.version = kwargs.get('version', None) - - -class EventResponseMessage(msrest.serialization.Model): - """The event response message received from the service URI. - - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventResponseMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.reason_phrase = kwargs.get('reason_phrase', None) - self.status_code = kwargs.get('status_code', None) - self.version = kwargs.get('version', None) - - -class ImportImageParameters(msrest.serialization.Model): - """ImportImageParameters. - - All required parameters must be populated in order to send to Azure. - - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will - be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only - copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any - existing target tags will fail the operation before any copying begins. Possible values - include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2017_10_01.models.ImportMode - """ - - _validation = { - 'source': {'required': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'ImportSource'}, - 'target_tags': {'key': 'targetTags', 'type': '[str]'}, - 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportImageParameters, self).__init__(**kwargs) - self.source = kwargs['source'] - self.target_tags = kwargs.get('target_tags', None) - self.untagged_target_repositories = kwargs.get('untagged_target_repositories', None) - self.mode = kwargs.get('mode', "NoForce") - - -class ImportSource(msrest.serialization.Model): - """ImportSource. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str - """ - - _validation = { - 'source_image': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'registry_uri': {'key': 'registryUri', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, - 'source_image': {'key': 'sourceImage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSource, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.registry_uri = kwargs.get('registry_uri', None) - self.credentials = kwargs.get('credentials', None) - self.source_image = kwargs['source_image'] - - -class ImportSourceCredentials(msrest.serialization.Model): - """ImportSourceCredentials. - - All required parameters must be populated in order to send to Azure. - - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str - """ - - _validation = { - 'password': {'required': True}, - } - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSourceCredentials, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs['password'] - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.ip_address_or_range = kwargs['ip_address_or_range'] - - -class NetworkRuleSet(msrest.serialization.Model): - """The network rule set for a container registry. - - All required parameters must be populated in order to send to Azure. - - :param default_action: Required. The default action of allow or deny when no other rules match. - Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.containerregistry.v2017_10_01.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2017_10_01.models.IPRule] - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', "Allow") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - - -class OperationDefinition(msrest.serialization.Model): - """The definition of a container registry operation. - - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: ~azure.mgmt.containerregistry.v2017_10_01.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: - ~azure.mgmt.containerregistry.v2017_10_01.models.OperationServiceSpecificationDefinition - """ - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDefinition, self).__init__(**kwargs) - self.origin = kwargs.get('origin', None) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplayDefinition(msrest.serialization.Model): - """The display information for a container registry operation. - - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The result of a request to list container registry operations. - - :param value: The list of container registry operations. Since this list may be incomplete, the - nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry - operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationMetricSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring metric. - - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class OperationServiceSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring metrics list. - - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: - list[~azure.mgmt.containerregistry.v2017_10_01.models.OperationMetricSpecificationDefinition] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class QuarantinePolicy(msrest.serialization.Model): - """An object that represents quarantine policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuarantinePolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - - -class RegenerateCredentialParameters(msrest.serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateCredentialParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class Registry(Resource): - """An object that represents a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku - :ivar login_server: The URL that can be used to log into the container registry. - :vartype login_server: str - :ivar creation_date: The creation date of the container registry in ISO8601 format. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the container registry at the time the - operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", - "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2017_10_01.models.ProvisioningState - :ivar status: The status of the container registry at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2017_10_01.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The properties of the storage account for the container registry. Only - applicable to Classic SKU. - :type storage_account: - ~azure.mgmt.containerregistry.v2017_10_01.models.StorageAccountProperties - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'login_server': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountProperties'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(Registry, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.login_server = None - self.creation_date = None - self.provisioning_state = None - self.status = None - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.storage_account = kwargs.get('storage_account', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class RegistryListCredentialsResult(msrest.serialization.Model): - """The response from the ListCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class RegistryListResult(msrest.serialization.Model): - """The result of a request to list container registries. - - :param value: The list of container registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Registry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegistryNameCheckRequest(msrest.serialization.Model): - """A request to check whether a container registry name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the container registry. - :type name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Has constant value: - "Microsoft.ContainerRegistry/registries". - :vartype type: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - **kwargs - ): - super(RegistryNameCheckRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class RegistryNameStatus(msrest.serialization.Model): - """The result of a request to check the availability of a container registry name. - - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryNameStatus, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class RegistryPassword(msrest.serialization.Model): - """The login password for the container registry. - - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName - :param value: The password value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPassword, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class RegistryPolicies(msrest.serialization.Model): - """An object that represents policies for a container registry. - - :param quarantine_policy: An object that represents quarantine policy for a container registry. - :type quarantine_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.QuarantinePolicy - :param trust_policy: An object that represents content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicy - """ - - _attribute_map = { - 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, - 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPolicies, self).__init__(**kwargs) - self.quarantine_policy = kwargs.get('quarantine_policy', None) - self.trust_policy = kwargs.get('trust_policy', None) - - -class RegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a container registry. - - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The parameters of a storage account for the container registry. Only - applicable to Classic SKU. If specified, the storage account must be in the same physical - location as the container registry. - :type storage_account: - ~azure.mgmt.containerregistry.v2017_10_01.models.StorageAccountProperties - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountProperties'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.admin_user_enabled = kwargs.get('admin_user_enabled', None) - self.storage_account = kwargs.get('storage_account', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - - -class RegistryUsage(msrest.serialization.Model): - """The quota usage for a container registry. - - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsageUnit - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsage, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.limit = kwargs.get('limit', None) - self.current_value = kwargs.get('current_value', None) - self.unit = kwargs.get('unit', None) - - -class RegistryUsageListResult(msrest.serialization.Model): - """The result of a request to get container registry quota usages. - - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RegistryUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Replication(Resource): - """An object that represents a replication for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: The provisioning state of the replication at the time the operation - was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2017_10_01.models.ProvisioningState - :ivar status: The status of the replication at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2017_10_01.models.Status - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - } - - def __init__( - self, - **kwargs - ): - super(Replication, self).__init__(**kwargs) - self.provisioning_state = None - self.status = None - - -class ReplicationListResult(msrest.serialization.Model): - """The result of a request to list replications for a container registry. - - :param value: The list of replications. Since this list may be incomplete, the nextLink field - should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Replication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationUpdateParameters(msrest.serialization.Model): - """The parameters for updating a replication. - - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Request(msrest.serialization.Model): - """The request that generated the event. - - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the - event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the - http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'addr': {'key': 'addr', 'type': 'str'}, - 'host': {'key': 'host', 'type': 'str'}, - 'method': {'key': 'method', 'type': 'str'}, - 'useragent': {'key': 'useragent', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.addr = kwargs.get('addr', None) - self.host = kwargs.get('host', None) - self.method = kwargs.get('method', None) - self.useragent = kwargs.get('useragent', None) - - -class Sku(msrest.serialization.Model): - """The SKU of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name of the container registry. Required for registry creation. - Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.SkuName - :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.containerregistry.v2017_10_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class Source(msrest.serialization.Model): - """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - - :param addr: The IP or hostname and the port of the registry node that generated the event. - Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str - """ - - _attribute_map = { - 'addr': {'key': 'addr', 'type': 'str'}, - 'instance_id': {'key': 'instanceID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Source, self).__init__(**kwargs) - self.addr = kwargs.get('addr', None) - self.instance_id = kwargs.get('instance_id', None) - - -class Status(msrest.serialization.Model): - """The status of an Azure resource at the time the operation was called. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_status: The short label for the status. - :vartype display_status: str - :ivar message: The detailed message for the status, including alerts and error messages. - :vartype message: str - :ivar timestamp: The timestamp when the status was changed to the current value. - :vartype timestamp: ~datetime.datetime - """ - - _validation = { - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'timestamp': {'readonly': True}, - } - - _attribute_map = { - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Status, self).__init__(**kwargs) - self.display_status = None - self.message = None - self.timestamp = None - - -class StorageAccountProperties(msrest.serialization.Model): - """The properties of a storage account for a container registry. Only applicable to Classic SKU. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The resource ID of the storage account. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountProperties, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class Target(msrest.serialization.Model): - """The target of the event. - - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str - """ - - _attribute_map = { - 'media_type': {'key': 'mediaType', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'long'}, - 'digest': {'key': 'digest', 'type': 'str'}, - 'length': {'key': 'length', 'type': 'long'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Target, self).__init__(**kwargs) - self.media_type = kwargs.get('media_type', None) - self.size = kwargs.get('size', None) - self.digest = kwargs.get('digest', None) - self.length = kwargs.get('length', None) - self.repository = kwargs.get('repository', None) - self.url = kwargs.get('url', None) - self.tag = kwargs.get('tag', None) - self.name = kwargs.get('name', None) - self.version = kwargs.get('version', None) - - -class TrustPolicy(msrest.serialization.Model): - """An object that represents content trust policy for a container registry. - - :param type: The type of trust policy. Possible values include: "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustPolicy, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.status = kwargs.get('status', None) - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual network rule. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - - -class Webhook(Resource): - """An object that represents a webhook for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] - :ivar provisioning_state: The provisioning state of the webhook at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2017_10_01.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Webhook, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - self.provisioning_state = None - - -class WebhookCreateParameters(msrest.serialization.Model): - """The parameters for creating a webhook. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the - resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - - -class WebhookListResult(msrest.serialization.Model): - """The result of a request to list webhooks for a container registry. - - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Webhook]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WebhookUpdateParameters(msrest.serialization.Model): - """The parameters for updating a webhook. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py index cd3b3b57e5ad..2833255b1ee3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py @@ -17,9 +17,9 @@ class Actor(msrest.serialization.Model): """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :param name: The subject or username associated with the request context that generated the + :ivar name: The subject or username associated with the request context that generated the event. - :type name: str + :vartype name: str """ _attribute_map = { @@ -32,6 +32,11 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The subject or username associated with the request context that generated the + event. + :paramtype name: str + """ super(Actor, self).__init__(**kwargs) self.name = name @@ -41,10 +46,10 @@ class CallbackConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] + :ivar service_uri: Required. The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] """ _validation = { @@ -63,6 +68,12 @@ def __init__( custom_headers: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword service_uri: Required. The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + """ super(CallbackConfig, self).__init__(**kwargs) self.service_uri = service_uri self.custom_headers = custom_headers @@ -71,8 +82,8 @@ def __init__( class EventInfo(msrest.serialization.Model): """The basic information of an event. - :param id: The event ID. - :type id: str + :ivar id: The event ID. + :vartype id: str """ _attribute_map = { @@ -85,6 +96,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + """ super(EventInfo, self).__init__(**kwargs) self.id = id @@ -92,13 +107,13 @@ def __init__( class Event(EventInfo): """The event for a webhook. - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: + :ivar id: The event ID. + :vartype id: str + :ivar event_request_message: The event request message sent to the service URI. + :vartype event_request_message: ~azure.mgmt.containerregistry.v2017_10_01.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: ~azure.mgmt.containerregistry.v2017_10_01.models.EventResponseMessage """ @@ -116,6 +131,16 @@ def __init__( event_response_message: Optional["EventResponseMessage"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword event_request_message: The event request message sent to the service URI. + :paramtype event_request_message: + ~azure.mgmt.containerregistry.v2017_10_01.models.EventRequestMessage + :keyword event_response_message: The event response message received from the service URI. + :paramtype event_response_message: + ~azure.mgmt.containerregistry.v2017_10_01.models.EventResponseMessage + """ super(Event, self).__init__(id=id, **kwargs) self.event_request_message = event_request_message self.event_response_message = event_response_message @@ -124,22 +149,22 @@ def __init__( class EventContent(msrest.serialization.Model): """The content of the event request message. - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2017_10_01.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2017_10_01.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar target: The target of the event. + :vartype target: ~azure.mgmt.containerregistry.v2017_10_01.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.v2017_10_01.models.Request + :ivar actor: The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2017_10_01.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor + :vartype actor: ~azure.mgmt.containerregistry.v2017_10_01.models.Actor + :ivar source: The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2017_10_01.models.Source + :vartype source: ~azure.mgmt.containerregistry.v2017_10_01.models.Source """ _attribute_map = { @@ -164,6 +189,24 @@ def __init__( source: Optional["Source"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword timestamp: The time at which the event occurred. + :paramtype timestamp: ~datetime.datetime + :keyword action: The action that encompasses the provided event. + :paramtype action: str + :keyword target: The target of the event. + :paramtype target: ~azure.mgmt.containerregistry.v2017_10_01.models.Target + :keyword request: The request that generated the event. + :paramtype request: ~azure.mgmt.containerregistry.v2017_10_01.models.Request + :keyword actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :paramtype actor: ~azure.mgmt.containerregistry.v2017_10_01.models.Actor + :keyword source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :paramtype source: ~azure.mgmt.containerregistry.v2017_10_01.models.Source + """ super(EventContent, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -177,11 +220,11 @@ def __init__( class EventListResult(msrest.serialization.Model): """The result of a request to list events for a webhook. - :param value: The list of events. Since this list may be incomplete, the nextLink field should + :ivar value: The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Event] + :ivar next_link: The URI that can be used to request the next list of events. + :vartype next_link: str """ _attribute_map = { @@ -196,6 +239,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of events. Since this list may be incomplete, the nextLink field + should be used to request the next list of events. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Event] + :keyword next_link: The URI that can be used to request the next list of events. + :paramtype next_link: str + """ super(EventListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -204,16 +254,16 @@ def __init__( class EventRequestMessage(msrest.serialization.Model): """The event request message sent to the service URI. - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2017_10_01.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.v2017_10_01.models.EventContent + :ivar headers: The headers of the event request message. + :vartype headers: dict[str, str] + :ivar method: The HTTP method used to send the event request message. + :vartype method: str + :ivar request_uri: The URI used to send the event request message. + :vartype request_uri: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -234,6 +284,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event request message. + :paramtype content: ~azure.mgmt.containerregistry.v2017_10_01.models.EventContent + :keyword headers: The headers of the event request message. + :paramtype headers: dict[str, str] + :keyword method: The HTTP method used to send the event request message. + :paramtype method: str + :keyword request_uri: The URI used to send the event request message. + :paramtype request_uri: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventRequestMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -245,16 +307,16 @@ def __init__( class EventResponseMessage(msrest.serialization.Model): """The event response message received from the service URI. - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event response message. + :vartype content: str + :ivar headers: The headers of the event response message. + :vartype headers: dict[str, str] + :ivar reason_phrase: The reason phrase of the event response message. + :vartype reason_phrase: str + :ivar status_code: The status code of the event response message. + :vartype status_code: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -275,6 +337,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event response message. + :paramtype content: str + :keyword headers: The headers of the event response message. + :paramtype headers: dict[str, str] + :keyword reason_phrase: The reason phrase of the event response message. + :paramtype reason_phrase: str + :keyword status_code: The status code of the event response message. + :paramtype status_code: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventResponseMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -288,18 +362,18 @@ class ImportImageParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + :ivar source: Required. The source of the image. + :vartype source: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSource + :ivar target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only + :vartype target_tags: list[str] + :ivar untagged_target_repositories: List of strings of repository names to do a manifest only copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + :vartype untagged_target_repositories: list[str] + :ivar mode: When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2017_10_01.models.ImportMode + :vartype mode: str or ~azure.mgmt.containerregistry.v2017_10_01.models.ImportMode """ _validation = { @@ -322,6 +396,20 @@ def __init__( mode: Optional[Union[str, "ImportMode"]] = "NoForce", **kwargs ): + """ + :keyword source: Required. The source of the image. + :paramtype source: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSource + :keyword target_tags: List of strings of the form repo[:tag]. When tag is omitted the source + will be used (or 'latest' if source tag is also omitted). + :paramtype target_tags: list[str] + :keyword untagged_target_repositories: List of strings of repository names to do a manifest + only copy. No tag will be created. + :paramtype untagged_target_repositories: list[str] + :keyword mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :paramtype mode: str or ~azure.mgmt.containerregistry.v2017_10_01.models.ImportMode + """ super(ImportImageParameters, self).__init__(**kwargs) self.source = source self.target_tags = target_tags @@ -334,17 +422,17 @@ class ImportSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. + :ivar resource_id: The resource identifier of the source Azure Container Registry. + :vartype resource_id: str + :ivar registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :vartype registry_uri: str + :ivar credentials: Credentials used when importing from a registry uri. + :vartype credentials: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSourceCredentials + :ivar source_image: Required. Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str + :vartype source_image: str """ _validation = { @@ -367,6 +455,20 @@ def __init__( credentials: Optional["ImportSourceCredentials"] = None, **kwargs ): + """ + :keyword resource_id: The resource identifier of the source Azure Container Registry. + :paramtype resource_id: str + :keyword registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :paramtype registry_uri: str + :keyword credentials: Credentials used when importing from a registry uri. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2017_10_01.models.ImportSourceCredentials + :keyword source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype source_image: str + """ super(ImportSource, self).__init__(**kwargs) self.resource_id = resource_id self.registry_uri = registry_uri @@ -379,10 +481,10 @@ class ImportSourceCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: Required. The password used to authenticate with the source registry. + :vartype password: str """ _validation = { @@ -401,6 +503,12 @@ def __init__( username: Optional[str] = None, **kwargs ): + """ + :keyword username: The username to authenticate with the source registry. + :paramtype username: str + :keyword password: Required. The password used to authenticate with the source registry. + :paramtype password: str + """ super(ImportSourceCredentials, self).__init__(**kwargs) self.username = username self.password = password @@ -411,11 +519,11 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar action: The action of IP ACL rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str + :vartype ip_address_or_range: str """ _validation = { @@ -434,6 +542,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of IP ACL rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + """ super(IPRule, self).__init__(**kwargs) self.action = action self.ip_address_or_range = ip_address_or_range @@ -444,14 +559,14 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param default_action: Required. The default action of allow or deny when no other rules match. + :ivar default_action: Required. The default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: + :vartype default_action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.DefaultAction + :ivar virtual_network_rules: The virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.containerregistry.v2017_10_01.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2017_10_01.models.IPRule] + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.v2017_10_01.models.IPRule] """ _validation = { @@ -472,6 +587,17 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword default_action: Required. The default action of allow or deny when no other rules + match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or + ~azure.mgmt.containerregistry.v2017_10_01.models.DefaultAction + :keyword virtual_network_rules: The virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.containerregistry.v2017_10_01.models.VirtualNetworkRule] + :keyword ip_rules: The IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.containerregistry.v2017_10_01.models.IPRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules @@ -481,14 +607,14 @@ def __init__( class OperationDefinition(msrest.serialization.Model): """The definition of a container registry operation. - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: ~azure.mgmt.containerregistry.v2017_10_01.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: + :ivar origin: The origin information of the container registry operation. + :vartype origin: str + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2017_10_01.models.OperationDisplayDefinition + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: ~azure.mgmt.containerregistry.v2017_10_01.models.OperationServiceSpecificationDefinition """ @@ -508,6 +634,17 @@ def __init__( service_specification: Optional["OperationServiceSpecificationDefinition"] = None, **kwargs ): + """ + :keyword origin: The origin information of the container registry operation. + :paramtype origin: str + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: ~azure.mgmt.containerregistry.v2017_10_01.models.OperationDisplayDefinition + :keyword service_specification: The definition of Azure Monitoring service. + :paramtype service_specification: + ~azure.mgmt.containerregistry.v2017_10_01.models.OperationServiceSpecificationDefinition + """ super(OperationDefinition, self).__init__(**kwargs) self.origin = origin self.name = name @@ -518,14 +655,14 @@ def __init__( class OperationDisplayDefinition(msrest.serialization.Model): """The display information for a container registry operation. - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str """ _attribute_map = { @@ -544,6 +681,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ super(OperationDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -554,12 +701,12 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The result of a request to list container registry operations. - :param value: The list of container registry operations. Since this list may be incomplete, the + :ivar value: The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry + :vartype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry operations. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -574,6 +721,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -582,18 +737,18 @@ def __init__( class OperationMetricSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring metric. - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str + :ivar name: Metric name. + :vartype name: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -616,6 +771,20 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Metric name. + :paramtype name: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword unit: Metric unit. + :paramtype unit: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword internal_metric_name: Internal metric name. + :paramtype internal_metric_name: str + """ super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -628,8 +797,8 @@ def __init__( class OperationServiceSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring metrics list. - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: list[~azure.mgmt.containerregistry.v2017_10_01.models.OperationMetricSpecificationDefinition] """ @@ -643,6 +812,11 @@ def __init__( metric_specifications: Optional[List["OperationMetricSpecificationDefinition"]] = None, **kwargs ): + """ + :keyword metric_specifications: A list of Azure Monitoring metrics definition. + :paramtype metric_specifications: + list[~azure.mgmt.containerregistry.v2017_10_01.models.OperationMetricSpecificationDefinition] + """ super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -650,9 +824,9 @@ def __init__( class QuarantinePolicy(msrest.serialization.Model): """An object that represents quarantine policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus """ _attribute_map = { @@ -665,6 +839,11 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus + """ super(QuarantinePolicy, self).__init__(**kwargs) self.status = status @@ -674,9 +853,9 @@ class RegenerateCredentialParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName """ _validation = { @@ -693,6 +872,11 @@ def __init__( name: Union[str, "PasswordName"], **kwargs ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName + """ super(RegenerateCredentialParameters, self).__init__(**kwargs) self.name = name @@ -710,11 +894,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -739,6 +923,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -760,13 +951,13 @@ class Registry(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku :ivar login_server: The URL that can be used to log into the container registry. :vartype login_server: str :ivar creation_date: The creation date of the container registry in ISO8601 format. @@ -778,14 +969,14 @@ class Registry(Resource): ~azure.mgmt.containerregistry.v2017_10_01.models.ProvisioningState :ivar status: The status of the container registry at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2017_10_01.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The properties of the storage account for the container registry. Only + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar storage_account: The properties of the storage account for the container registry. Only applicable to Classic SKU. - :type storage_account: + :vartype storage_account: ~azure.mgmt.containerregistry.v2017_10_01.models.StorageAccountProperties - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet """ _validation = { @@ -827,6 +1018,23 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword storage_account: The properties of the storage account for the container registry. + Only applicable to Classic SKU. + :paramtype storage_account: + ~azure.mgmt.containerregistry.v2017_10_01.models.StorageAccountProperties + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet + """ super(Registry, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.login_server = None @@ -841,10 +1049,10 @@ def __init__( class RegistryListCredentialsResult(msrest.serialization.Model): """The response from the ListCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPassword] + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPassword] """ _attribute_map = { @@ -859,6 +1067,12 @@ def __init__( passwords: Optional[List["RegistryPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPassword] + """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -867,11 +1081,11 @@ def __init__( class RegistryListResult(msrest.serialization.Model): """The result of a request to list container registries. - :param value: The list of container registries. Since this list may be incomplete, the nextLink + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str """ _attribute_map = { @@ -886,6 +1100,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ super(RegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -898,8 +1119,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the container registry. - :type name: str + :ivar name: Required. The name of the container registry. + :vartype name: str :ivar type: The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". @@ -924,6 +1145,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ super(RegistryNameCheckRequest, self).__init__(**kwargs) self.name = name @@ -931,13 +1156,13 @@ def __init__( class RegistryNameStatus(msrest.serialization.Model): """The result of a request to check the availability of a container registry name. - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str """ _attribute_map = { @@ -954,6 +1179,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ super(RegistryNameStatus, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -963,10 +1197,10 @@ def __init__( class RegistryPassword(msrest.serialization.Model): """The login password for the container registry. - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName - :param value: The password value. - :type value: str + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName + :ivar value: The password value. + :vartype value: str """ _attribute_map = { @@ -981,6 +1215,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ super(RegistryPassword, self).__init__(**kwargs) self.name = name self.value = value @@ -989,10 +1229,10 @@ def __init__( class RegistryPolicies(msrest.serialization.Model): """An object that represents policies for a container registry. - :param quarantine_policy: An object that represents quarantine policy for a container registry. - :type quarantine_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.QuarantinePolicy - :param trust_policy: An object that represents content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicy + :ivar quarantine_policy: An object that represents quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.QuarantinePolicy + :ivar trust_policy: An object that represents content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicy """ _attribute_map = { @@ -1007,6 +1247,13 @@ def __init__( trust_policy: Optional["TrustPolicy"] = None, **kwargs ): + """ + :keyword quarantine_policy: An object that represents quarantine policy for a container + registry. + :paramtype quarantine_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.QuarantinePolicy + :keyword trust_policy: An object that represents content trust policy for a container registry. + :paramtype trust_policy: ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicy + """ super(RegistryPolicies, self).__init__(**kwargs) self.quarantine_policy = quarantine_policy self.trust_policy = trust_policy @@ -1015,19 +1262,19 @@ def __init__( class RegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a container registry. - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The parameters of a storage account for the container registry. Only + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar storage_account: The parameters of a storage account for the container registry. Only applicable to Classic SKU. If specified, the storage account must be in the same physical location as the container registry. - :type storage_account: + :vartype storage_account: ~azure.mgmt.containerregistry.v2017_10_01.models.StorageAccountProperties - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet """ _attribute_map = { @@ -1048,6 +1295,21 @@ def __init__( network_rule_set: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2017_10_01.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword storage_account: The parameters of a storage account for the container registry. Only + applicable to Classic SKU. If specified, the storage account must be in the same physical + location as the container registry. + :paramtype storage_account: + ~azure.mgmt.containerregistry.v2017_10_01.models.StorageAccountProperties + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: ~azure.mgmt.containerregistry.v2017_10_01.models.NetworkRuleSet + """ super(RegistryUpdateParameters, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1059,14 +1321,14 @@ def __init__( class RegistryUsage(msrest.serialization.Model): """The quota usage for a container registry. - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsageUnit + :ivar name: The name of the usage. + :vartype name: str + :ivar limit: The limit of the usage. + :vartype limit: long + :ivar current_value: The current value of the usage. + :vartype current_value: long + :ivar unit: The unit of measurement. Possible values include: "Count", "Bytes". + :vartype unit: str or ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsageUnit """ _attribute_map = { @@ -1085,6 +1347,16 @@ def __init__( unit: Optional[Union[str, "RegistryUsageUnit"]] = None, **kwargs ): + """ + :keyword name: The name of the usage. + :paramtype name: str + :keyword limit: The limit of the usage. + :paramtype limit: long + :keyword current_value: The current value of the usage. + :paramtype current_value: long + :keyword unit: The unit of measurement. Possible values include: "Count", "Bytes". + :paramtype unit: str or ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsageUnit + """ super(RegistryUsage, self).__init__(**kwargs) self.name = name self.limit = limit @@ -1095,8 +1367,8 @@ def __init__( class RegistryUsageListResult(msrest.serialization.Model): """The result of a request to get container registry quota usages. - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsage] + :ivar value: The list of container registry quota usages. + :vartype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsage] """ _attribute_map = { @@ -1109,6 +1381,10 @@ def __init__( value: Optional[List["RegistryUsage"]] = None, **kwargs ): + """ + :keyword value: The list of container registry quota usages. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUsage] + """ super(RegistryUsageListResult, self).__init__(**kwargs) self.value = value @@ -1126,11 +1402,11 @@ class Replication(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar provisioning_state: The provisioning state of the replication at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -1166,6 +1442,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Replication, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.status = None @@ -1174,11 +1457,11 @@ def __init__( class ReplicationListResult(msrest.serialization.Model): """The result of a request to list replications for a container registry. - :param value: The list of replications. Since this list may be incomplete, the nextLink field + :ivar value: The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] + :ivar next_link: The URI that can be used to request the next list of replications. + :vartype next_link: str """ _attribute_map = { @@ -1193,6 +1476,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] + :keyword next_link: The URI that can be used to request the next list of replications. + :paramtype next_link: str + """ super(ReplicationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1201,8 +1491,8 @@ def __init__( class ReplicationUpdateParameters(msrest.serialization.Model): """The parameters for updating a replication. - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] + :ivar tags: A set of tags. The tags for the replication. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1215,6 +1505,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the replication. + :paramtype tags: dict[str, str] + """ super(ReplicationUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -1222,18 +1516,18 @@ def __init__( class Request(msrest.serialization.Model): """The request that generated the event. - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str """ _attribute_map = { @@ -1254,6 +1548,20 @@ def __init__( useragent: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the request that initiated the event. + :paramtype id: str + :keyword addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :paramtype addr: str + :keyword host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :paramtype host: str + :keyword method: The request method that generated the event. + :paramtype method: str + :keyword useragent: The user agent header of the request. + :paramtype useragent: str + """ super(Request, self).__init__(**kwargs) self.id = id self.addr = addr @@ -1269,9 +1577,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name of the container registry. Required for registry creation. + :ivar name: Required. The SKU name of the container registry. Required for registry creation. Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.SkuName + :vartype name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.SkuName :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", "Standard", "Premium". :vartype tier: str or ~azure.mgmt.containerregistry.v2017_10_01.models.SkuTier @@ -1293,6 +1601,11 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Possible values include: "Classic", "Basic", "Standard", "Premium". + :paramtype name: str or ~azure.mgmt.containerregistry.v2017_10_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1301,11 +1614,11 @@ def __init__( class Source(msrest.serialization.Model): """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :param addr: The IP or hostname and the port of the registry node that generated the event. + :ivar addr: The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str """ _attribute_map = { @@ -1320,6 +1633,13 @@ def __init__( instance_id: Optional[str] = None, **kwargs ): + """ + :keyword addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :paramtype addr: str + :keyword instance_id: The running instance of an application. Changes after each restart. + :paramtype instance_id: str + """ super(Source, self).__init__(**kwargs) self.addr = addr self.instance_id = instance_id @@ -1354,6 +1674,8 @@ def __init__( self, **kwargs ): + """ + """ super(Status, self).__init__(**kwargs) self.display_status = None self.message = None @@ -1365,8 +1687,8 @@ class StorageAccountProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The resource ID of the storage account. - :type id: str + :ivar id: Required. The resource ID of the storage account. + :vartype id: str """ _validation = { @@ -1383,6 +1705,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The resource ID of the storage account. + :paramtype id: str + """ super(StorageAccountProperties, self).__init__(**kwargs) self.id = id @@ -1390,24 +1716,24 @@ def __init__( class Target(msrest.serialization.Model): """The target of the event. - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: long + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: long + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str """ _attribute_map = { @@ -1436,6 +1762,27 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword media_type: The MIME type of the referenced object. + :paramtype media_type: str + :keyword size: The number of bytes of the content. Same as Length field. + :paramtype size: long + :keyword digest: The digest of the content, as defined by the Registry V2 HTTP API + Specification. + :paramtype digest: str + :keyword length: The number of bytes of the content. Same as Size field. + :paramtype length: long + :keyword repository: The repository name. + :paramtype repository: str + :keyword url: The direct URL to the content. + :paramtype url: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword name: The name of the artifact. + :paramtype name: str + :keyword version: The version of the artifact. + :paramtype version: str + """ super(Target, self).__init__(**kwargs) self.media_type = media_type self.size = size @@ -1451,11 +1798,11 @@ def __init__( class TrustPolicy(msrest.serialization.Model): """An object that represents content trust policy for a container registry. - :param type: The type of trust policy. Possible values include: "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar type: The type of trust policy. Possible values include: "Notary". + :vartype type: str or ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus """ _attribute_map = { @@ -1470,6 +1817,13 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword type: The type of trust policy. Possible values include: "Notary". + :paramtype type: str or ~azure.mgmt.containerregistry.v2017_10_01.models.TrustPolicyType + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.PolicyStatus + """ super(TrustPolicy, self).__init__(**kwargs) self.type = type self.status = status @@ -1480,11 +1834,11 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar action: The action of virtual network rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str + :vartype virtual_network_resource_id: str """ _validation = { @@ -1503,6 +1857,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of virtual network rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2017_10_01.models.Action + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.action = action self.virtual_network_resource_id = virtual_network_resource_id @@ -1521,20 +1882,20 @@ class Webhook(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] :ivar provisioning_state: The provisioning state of the webhook at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -1572,6 +1933,22 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] + """ super(Webhook, self).__init__(location=location, tags=tags, **kwargs) self.status = status self.scope = scope @@ -1584,24 +1961,24 @@ class WebhookCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the webhook. This cannot be changed after the resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] """ _validation = { @@ -1630,6 +2007,26 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] + """ super(WebhookCreateParameters, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1643,11 +2040,11 @@ def __init__( class WebhookListResult(msrest.serialization.Model): """The result of a request to list webhooks for a container registry. - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str + :ivar value: The list of webhooks. Since this list may be incomplete, the nextLink field should + be used to request the next list of webhooks. + :vartype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] + :ivar next_link: The URI that can be used to request the next list of webhooks. + :vartype next_link: str """ _attribute_map = { @@ -1662,6 +2059,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :paramtype value: list[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] + :keyword next_link: The URI that can be used to request the next list of webhooks. + :paramtype next_link: str + """ super(WebhookListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1670,21 +2074,21 @@ def __init__( class WebhookUpdateParameters(msrest.serialization.Model): """The parameters for updating a webhook. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] """ _attribute_map = { @@ -1707,6 +2111,23 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookAction] + """ super(WebhookUpdateParameters, self).__init__(**kwargs) self.tags = tags self.service_uri = service_uri diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_operations.py index 26efe4b42c83..87d23176cc92 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Container Registry REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_registries_operations.py index 5f083fb3d299..21e2800ede8d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_registries_operations.py @@ -5,25 +5,519 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_import_image_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_policies_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_policies_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -49,41 +543,32 @@ def __init__(self, client, config, serializer, deserializer): def _import_image_initial( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,14 +581,15 @@ def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace def begin_import_image( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> LROPoller[None]: """Copies an image to this container registry from the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -116,15 +602,18 @@ def begin_import_image( :type parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -136,24 +625,18 @@ def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -165,20 +648,22 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace def check_name_availability( self, - registry_name_check_request, # type: "_models.RegistryNameCheckRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryNameStatus" + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": """Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryNameStatus @@ -189,30 +674,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,15 +701,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": """Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -252,27 +729,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,47 +753,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -344,16 +802,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -365,15 +825,19 @@ def begin_create( :type registry: ~azure.mgmt.containerregistry.v2017_10_01.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,27 +849,21 @@ def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -417,39 +875,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -462,13 +912,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -478,15 +929,17 @@ def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -500,21 +953,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -526,47 +972,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -584,16 +1020,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -602,18 +1040,23 @@ def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -625,27 +1068,21 @@ def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,14 +1094,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry @@ -672,7 +1110,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -680,35 +1119,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -726,21 +1161,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -748,34 +1185,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,18 +1225,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -822,27 +1255,17 @@ def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -856,16 +1279,18 @@ def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace def regenerate_credential( self, - resource_group_name, # type: str - registry_name, # type: str - regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -875,7 +1300,8 @@ def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryListCredentialsResult @@ -886,32 +1312,22 @@ def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -925,15 +1341,17 @@ def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace def list_usages( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryUsageListResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": """Gets the quota usages for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -951,27 +1369,17 @@ def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,15 +1393,17 @@ def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_policies( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryPolicies" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryPolicies": """Lists the policies for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1011,27 +1421,17 @@ def list_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.list_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_policies_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_policies.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1045,47 +1445,38 @@ def list_policies( return cls(pipeline_response, deserialized, {}) return deserialized + list_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listPolicies'} # type: ignore + def _update_policies_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_policies_update_parameters, # type: "_models.RegistryPolicies" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RegistryPolicies"] + resource_group_name: str, + registry_name: str, + registry_policies_update_parameters: "_models.RegistryPolicies", + **kwargs: Any + ) -> Optional["_models.RegistryPolicies"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RegistryPolicies"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_policies_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_policies_update_parameters, 'RegistryPolicies') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_policies_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_policies_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_policies_update_parameters, 'RegistryPolicies') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1101,16 +1492,18 @@ def _update_policies_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_policies_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies'} # type: ignore + + @distributed_trace def begin_update_policies( self, - resource_group_name, # type: str - registry_name, # type: str - registry_policies_update_parameters, # type: "_models.RegistryPolicies" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RegistryPolicies"] + resource_group_name: str, + registry_name: str, + registry_policies_update_parameters: "_models.RegistryPolicies", + **kwargs: Any + ) -> LROPoller["_models.RegistryPolicies"]: """Updates the policies for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1120,18 +1513,24 @@ def begin_update_policies( :type registry_name: str :param registry_policies_update_parameters: The parameters for updating policies of a container registry. - :type registry_policies_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies + :type registry_policies_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RegistryPolicies or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RegistryPolicies or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.RegistryPolicies] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryPolicies"] lro_delay = kwargs.pop( 'polling_interval', @@ -1143,27 +1542,21 @@ def begin_update_policies( resource_group_name=resource_group_name, registry_name=registry_name, registry_policies_update_parameters=registry_policies_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RegistryPolicies', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1175,4 +1568,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_replications_operations.py index 9fb83ddf6334..4db16047c3dc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_replications_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReplicationsOperations(object): """ReplicationsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": """Gets the properties of the specified replication. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Creates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,20 @@ def begin_create( :type replication: ~azure.mgmt.containerregistry.v2017_10_01.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a replication from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Updates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,24 @@ def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +632,21 @@ def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +658,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationListResult"]: """Lists all the replications for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -518,8 +676,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -527,36 +687,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +731,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_webhooks_operations.py index 4f71dc004b2b..5f24c496a75b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/operations/_webhooks_operations.py @@ -5,25 +5,334 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_ping_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_callback_config_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_events_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2017-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebhooksOperations(object): """WebhooksOperations operations. @@ -47,14 +356,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": """Gets the properties of the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +383,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +408,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +459,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Creates a webhook for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +482,22 @@ def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +510,21 @@ def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +536,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +575,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a webhook from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +595,17 @@ def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +620,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +639,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +689,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Updates a webhook with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +712,22 @@ def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2017_10_01.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2017_10_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +740,21 @@ def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +766,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebhookListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.WebhookListResult"]: """Lists all the webhooks for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +785,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.WebhookListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -527,36 +794,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,19 +838,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace def ping( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventInfo" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": """Triggers a ping event to be sent to the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +871,18 @@ def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +896,18 @@ def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace def get_callback_config( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CallbackConfig" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": """Gets the configuration of service URI and custom headers for the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -670,28 +927,18 @@ def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -705,16 +952,18 @@ def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventListResult"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> Iterable["_models.EventListResult"]: """Lists recent events for the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -726,7 +975,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.EventListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2017_10_01.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -734,37 +984,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -782,6 +1030,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_configuration.py index dbcb6a353676..3e0368d0aa24 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_container_registry_management_client.py index fad7cad9f3c8..a1617c97d303 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_container_registry_management_client.py @@ -6,89 +6,90 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import BuildStepsOperations, BuildTasksOperations, BuildsOperations, RegistriesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import BuildsOperations -from .operations import BuildStepsOperations -from .operations import BuildTasksOperations -from .operations import RegistriesOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar builds: BuildsOperations operations :vartype builds: azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildsOperations :ivar build_steps: BuildStepsOperations operations - :vartype build_steps: azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildStepsOperations + :vartype build_steps: + azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildStepsOperations :ivar build_tasks: BuildTasksOperations operations - :vartype build_tasks: azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildTasksOperations + :vartype build_tasks: + azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildTasksOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2018_02_01_preview.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2018_02_01_preview.operations.RegistriesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_steps = BuildStepsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_tasks = BuildTasksOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.builds = BuildsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_steps = BuildStepsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_tasks = BuildTasksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_metadata.json index 020cfe32ec55..d9841f268d0d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "builds": "BuildsOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_configuration.py index f0467fb23e8c..3b9c9d2ff258 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_container_registry_management_client.py index bb959d75d1c7..dff8673cf361 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_container_registry_management_client.py @@ -6,85 +6,91 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import BuildStepsOperations, BuildTasksOperations, BuildsOperations, RegistriesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import BuildsOperations -from .operations import BuildStepsOperations -from .operations import BuildTasksOperations -from .operations import RegistriesOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar builds: BuildsOperations operations - :vartype builds: azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildsOperations + :vartype builds: + azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildsOperations :ivar build_steps: BuildStepsOperations operations - :vartype build_steps: azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildStepsOperations + :vartype build_steps: + azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildStepsOperations :ivar build_tasks: BuildTasksOperations operations - :vartype build_tasks: azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildTasksOperations + :vartype build_tasks: + azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildTasksOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.RegistriesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_steps = BuildStepsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_tasks = BuildTasksOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.builds = BuildsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_steps = BuildStepsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_tasks = BuildTasksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_steps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_steps_operations.py index 3de801556f24..3ec496142595 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_steps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_steps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._build_steps_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_build_arguments_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -61,7 +67,8 @@ def list( :type build_task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildStepList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStepList"] @@ -69,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildStepList', pipeline_response) + deserialized = self._deserialize("BuildStepList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -151,29 +158,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,8 +184,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -203,34 +202,24 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_step_create_parameters, 'BuildStep') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_step_create_parameters, 'BuildStep') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,8 +237,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -271,18 +263,24 @@ async def begin_create( :param step_name: The name of a build step for a container registry build task. :type step_name: str :param build_step_create_parameters: The parameters for creating a build step. - :type build_step_create_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep + :type build_step_create_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildStep or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildStep or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStep"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +294,21 @@ async def begin_create( build_task_name=build_task_name, step_name=step_name, build_step_create_parameters=build_step_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildStep', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -330,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore async def _delete_initial( @@ -345,27 +336,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -378,6 +361,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -399,15 +384,17 @@ async def begin_delete( :type step_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -423,23 +410,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -451,6 +429,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore async def _update_initial( @@ -467,34 +446,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_step_update_parameters, 'BuildStepUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_step_update_parameters, 'BuildStepUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,8 +481,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -535,18 +507,24 @@ async def begin_update( :param step_name: The name of a build step for a container registry build task. :type step_name: str :param build_step_update_parameters: The parameters for updating a build step. - :type build_step_update_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters + :type build_step_update_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildStep or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildStep or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStep"] lro_delay = kwargs.pop( 'polling_interval', @@ -560,29 +538,21 @@ async def begin_update( build_task_name=build_task_name, step_name=step_name, build_step_update_parameters=build_step_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildStep', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -594,8 +564,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + @distributed_trace def list_build_arguments( self, resource_group_name: str, @@ -617,7 +589,8 @@ def list_build_arguments( :type step_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildArgumentList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildArgumentList"] @@ -625,38 +598,37 @@ def list_build_arguments( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_build_arguments.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_build_arguments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=self.list_build_arguments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_arguments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildArgumentList', pipeline_response) + deserialized = self._deserialize("BuildArgumentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -674,6 +646,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_tasks_operations.py index c7fb4c55e324..e09ecb8c5f16 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_tasks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._build_tasks_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_list_source_repository_properties_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -65,7 +71,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildTaskListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTaskListResult"] @@ -73,40 +80,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildTaskListResult', pipeline_response) + deserialized = self._deserialize("BuildTaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +128,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -155,28 +161,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -205,33 +203,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_task_create_parameters, 'BuildTask') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_task_create_parameters, 'BuildTask') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,8 +237,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -269,18 +260,24 @@ async def begin_create( :param build_task_name: The name of the container registry build task. :type build_task_name: str :param build_task_create_parameters: The parameters for creating a build task. - :type build_task_create_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask + :type build_task_create_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildTask or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildTask or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTask"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +290,21 @@ async def begin_create( registry_name=registry_name, build_task_name=build_task_name, build_task_create_parameters=build_task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildTask', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -326,6 +316,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore async def _delete_initial( @@ -340,26 +331,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -372,6 +355,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -390,15 +375,17 @@ async def begin_delete( :type build_task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -413,22 +400,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -440,6 +419,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore async def _update_initial( @@ -455,33 +435,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build_task_update_parameters, 'BuildTaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_task_update_parameters, 'BuildTaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,8 +469,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -519,18 +492,24 @@ async def begin_update( :param build_task_name: The name of the container registry build task. :type build_task_name: str :param build_task_update_parameters: The parameters for updating a build task. - :type build_task_update_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters + :type build_task_update_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildTask or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildTask or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTask"] lro_delay = kwargs.pop( 'polling_interval', @@ -543,28 +522,21 @@ async def begin_update( registry_name=registry_name, build_task_name=build_task_name, build_task_update_parameters=build_task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildTask', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -576,8 +548,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + @distributed_trace_async async def list_source_repository_properties( self, resource_group_name: str, @@ -604,28 +578,18 @@ async def list_source_repository_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_source_repository_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_source_repository_properties_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self.list_source_repository_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -639,4 +603,6 @@ async def list_source_repository_properties( return cls(pipeline_response, deserialized, {}) return deserialized + list_source_repository_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_builds_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_builds_operations.py index f45298af1021..031209f01d37 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_builds_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_builds_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._builds_operations import build_cancel_request_initial, build_get_log_link_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildListResult"] @@ -77,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildListResult', pipeline_response) + deserialized = self._deserialize("BuildListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,11 +134,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -161,28 +167,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,8 +192,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -211,33 +209,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_update_parameters, 'BuildUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_update_parameters, 'BuildUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,8 +243,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -275,18 +266,23 @@ async def begin_update( :param build_id: The build ID. :type build_id: str :param build_update_parameters: The build update properties. - :type build_update_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters + :type build_update_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Build or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,28 +295,21 @@ async def begin_update( registry_name=registry_name, build_id=build_id, build_update_parameters=build_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Build', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +321,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'} # type: ignore + @distributed_trace_async async def get_log_link( self, resource_group_name: str, @@ -360,28 +351,18 @@ async def get_log_link( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_link.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_link_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + template_url=self.get_log_link.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -395,8 +376,10 @@ async def get_log_link( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink'} # type: ignore + async def _cancel_initial( self, resource_group_name: str, @@ -409,26 +392,18 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,6 +416,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -459,15 +436,17 @@ async def begin_cancel( :type build_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -482,22 +461,14 @@ async def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -509,4 +480,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_registries_operations.py index 8aab676d7c0c..4862a8253c77 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_registries_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_get_build_source_upload_url_request, build_queue_build_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,32 +58,22 @@ async def _queue_build_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._queue_build_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_request, 'QueueBuildRequest') + + request = build_queue_build_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._queue_build_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_request, 'QueueBuildRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,8 +89,11 @@ async def _queue_build_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _queue_build_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild'} # type: ignore + + @distributed_trace_async async def begin_queue_build( self, resource_group_name: str, @@ -115,15 +112,19 @@ async def begin_queue_build( :type build_request: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.QueueBuildRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Build or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,27 +136,21 @@ async def begin_queue_build( resource_group_name=resource_group_name, registry_name=registry_name, build_request=build_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Build', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,8 +162,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_queue_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild'} # type: ignore + @distributed_trace_async async def get_build_source_upload_url( self, resource_group_name: str, @@ -192,27 +189,17 @@ async def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,4 +213,6 @@ async def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/__init__.py index fef0d08a0a81..7d20d2b67372 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/__init__.py @@ -6,72 +6,39 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import BaseImageDependency - from ._models_py3 import Build - from ._models_py3 import BuildArgument - from ._models_py3 import BuildArgumentList - from ._models_py3 import BuildFilter - from ._models_py3 import BuildGetLogResult - from ._models_py3 import BuildListResult - from ._models_py3 import BuildStep - from ._models_py3 import BuildStepList - from ._models_py3 import BuildStepProperties - from ._models_py3 import BuildStepPropertiesUpdateParameters - from ._models_py3 import BuildStepUpdateParameters - from ._models_py3 import BuildTask - from ._models_py3 import BuildTaskBuildRequest - from ._models_py3 import BuildTaskFilter - from ._models_py3 import BuildTaskListResult - from ._models_py3 import BuildTaskUpdateParameters - from ._models_py3 import BuildUpdateParameters - from ._models_py3 import DockerBuildStep - from ._models_py3 import DockerBuildStepUpdateParameters - from ._models_py3 import GitCommitTrigger - from ._models_py3 import ImageDescriptor - from ._models_py3 import ImageUpdateTrigger - from ._models_py3 import PlatformProperties - from ._models_py3 import ProxyResource - from ._models_py3 import QueueBuildRequest - from ._models_py3 import QuickBuildRequest - from ._models_py3 import Resource - from ._models_py3 import SourceControlAuthInfo - from ._models_py3 import SourceRepositoryProperties - from ._models_py3 import SourceRepositoryUpdateParameters - from ._models_py3 import SourceUploadDefinition -except (SyntaxError, ImportError): - from ._models import BaseImageDependency # type: ignore - from ._models import Build # type: ignore - from ._models import BuildArgument # type: ignore - from ._models import BuildArgumentList # type: ignore - from ._models import BuildFilter # type: ignore - from ._models import BuildGetLogResult # type: ignore - from ._models import BuildListResult # type: ignore - from ._models import BuildStep # type: ignore - from ._models import BuildStepList # type: ignore - from ._models import BuildStepProperties # type: ignore - from ._models import BuildStepPropertiesUpdateParameters # type: ignore - from ._models import BuildStepUpdateParameters # type: ignore - from ._models import BuildTask # type: ignore - from ._models import BuildTaskBuildRequest # type: ignore - from ._models import BuildTaskFilter # type: ignore - from ._models import BuildTaskListResult # type: ignore - from ._models import BuildTaskUpdateParameters # type: ignore - from ._models import BuildUpdateParameters # type: ignore - from ._models import DockerBuildStep # type: ignore - from ._models import DockerBuildStepUpdateParameters # type: ignore - from ._models import GitCommitTrigger # type: ignore - from ._models import ImageDescriptor # type: ignore - from ._models import ImageUpdateTrigger # type: ignore - from ._models import PlatformProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueueBuildRequest # type: ignore - from ._models import QuickBuildRequest # type: ignore - from ._models import Resource # type: ignore - from ._models import SourceControlAuthInfo # type: ignore - from ._models import SourceRepositoryProperties # type: ignore - from ._models import SourceRepositoryUpdateParameters # type: ignore - from ._models import SourceUploadDefinition # type: ignore +from ._models_py3 import BaseImageDependency +from ._models_py3 import Build +from ._models_py3 import BuildArgument +from ._models_py3 import BuildArgumentList +from ._models_py3 import BuildFilter +from ._models_py3 import BuildGetLogResult +from ._models_py3 import BuildListResult +from ._models_py3 import BuildStep +from ._models_py3 import BuildStepList +from ._models_py3 import BuildStepProperties +from ._models_py3 import BuildStepPropertiesUpdateParameters +from ._models_py3 import BuildStepUpdateParameters +from ._models_py3 import BuildTask +from ._models_py3 import BuildTaskBuildRequest +from ._models_py3 import BuildTaskFilter +from ._models_py3 import BuildTaskListResult +from ._models_py3 import BuildTaskUpdateParameters +from ._models_py3 import BuildUpdateParameters +from ._models_py3 import DockerBuildStep +from ._models_py3 import DockerBuildStepUpdateParameters +from ._models_py3 import GitCommitTrigger +from ._models_py3 import ImageDescriptor +from ._models_py3 import ImageUpdateTrigger +from ._models_py3 import PlatformProperties +from ._models_py3 import ProxyResource +from ._models_py3 import QueueBuildRequest +from ._models_py3 import QuickBuildRequest +from ._models_py3 import Resource +from ._models_py3 import SourceControlAuthInfo +from ._models_py3 import SourceRepositoryProperties +from ._models_py3 import SourceRepositoryUpdateParameters +from ._models_py3 import SourceUploadDefinition + from ._container_registry_management_client_enums import ( BaseImageDependencyType, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_container_registry_management_client_enums.py index 6a0ad91fdfff..9499ac62cc76 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_container_registry_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class BaseImageDependencyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageDependencyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the base image dependency. """ BUILD_TIME = "BuildTime" RUN_TIME = "RunTime" -class BaseImageTriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageTriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the auto trigger for base image dependency updates. """ @@ -41,13 +26,13 @@ class BaseImageTriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RUNTIME = "Runtime" NONE = "None" -class BuildArgumentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildArgumentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the argument. """ DOCKER_BUILD_ARGUMENT = "DockerBuildArgument" -class BuildStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the build. """ @@ -60,34 +45,34 @@ class BuildStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" TIMEOUT = "Timeout" -class BuildStepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildStepType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the step. """ DOCKER = "Docker" -class BuildTaskStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildTaskStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of build task. """ DISABLED = "Disabled" ENABLED = "Enabled" -class BuildType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of build. """ AUTO_BUILD = "AutoBuild" QUICK_BUILD = "QuickBuild" -class OsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system type required for the build. """ WINDOWS = "Windows" LINUX = "Linux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of a build. """ @@ -98,14 +83,14 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class SourceControlType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceControlType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source control service. """ GITHUB = "Github" VISUAL_STUDIO_TEAM_SERVICE = "VisualStudioTeamService" -class TokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Auth token. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models.py deleted file mode 100644 index ccf649d27c6d..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models.py +++ /dev/null @@ -1,1254 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class BaseImageDependency(msrest.serialization.Model): - """Properties that describe a base image dependency. - - :param type: The type of the base image dependency. Possible values include: "BuildTime", - "RunTime". - :type type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageDependency, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Build(ProxyResource): - """Build resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param build_id: The unique identifier for the build. - :type build_id: str - :param status: The current status of the build. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :param last_updated_time: The last updated time for the build. - :type last_updated_time: ~datetime.datetime - :param build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". - :type build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :param create_time: The time the build was created. - :type create_time: ~datetime.datetime - :param start_time: The time the build started. - :type start_time: ~datetime.datetime - :param finish_time: The time the build finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the build. - :type output_images: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] - :param build_task: The build task with which the build was started. - :type build_task: str - :param image_update_trigger: The image update trigger that caused the build. - :type image_update_trigger: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageUpdateTrigger - :param git_commit_trigger: The git commit trigger that caused the build. - :type git_commit_trigger: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.GitCommitTrigger - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param platform: The platform properties against which the build will happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param provisioning_state: The provisioning state of a build. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'build_id': {'key': 'properties.buildId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, - 'build_type': {'key': 'properties.buildType', 'type': 'str'}, - 'create_time': {'key': 'properties.createTime', 'type': 'iso-8601'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'properties.finishTime', 'type': 'iso-8601'}, - 'output_images': {'key': 'properties.outputImages', 'type': '[ImageDescriptor]'}, - 'build_task': {'key': 'properties.buildTask', 'type': 'str'}, - 'image_update_trigger': {'key': 'properties.imageUpdateTrigger', 'type': 'ImageUpdateTrigger'}, - 'git_commit_trigger': {'key': 'properties.gitCommitTrigger', 'type': 'GitCommitTrigger'}, - 'is_archive_enabled': {'key': 'properties.isArchiveEnabled', 'type': 'bool'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Build, self).__init__(**kwargs) - self.build_id = kwargs.get('build_id', None) - self.status = kwargs.get('status', None) - self.last_updated_time = kwargs.get('last_updated_time', None) - self.build_type = kwargs.get('build_type', None) - self.create_time = kwargs.get('create_time', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_images = kwargs.get('output_images', None) - self.build_task = kwargs.get('build_task', None) - self.image_update_trigger = kwargs.get('image_update_trigger', None) - self.git_commit_trigger = kwargs.get('git_commit_trigger', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', False) - self.platform = kwargs.get('platform', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class BuildArgument(msrest.serialization.Model): - """Properties of a build argument. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the argument. Possible values include: - "DockerBuildArgument". - :type type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentType - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be - removed from build logs. - :type is_secret: bool - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'is_secret': {'key': 'isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildArgument, self).__init__(**kwargs) - self.type = kwargs['type'] - self.name = kwargs['name'] - self.value = kwargs['value'] - self.is_secret = kwargs.get('is_secret', False) - - -class BuildArgumentList(msrest.serialization.Model): - """The list of build arguments for a build step. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildArgument]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildArgumentList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BuildFilter(msrest.serialization.Model): - """Properties that are enabled for Odata querying. - - :param build_id: The unique identifier for the build. - :type build_id: str - :param build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". - :type build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :param status: The current status of the build. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :param create_time: The create time for a build. - :type create_time: ~datetime.datetime - :param finish_time: The time the build finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated - from the build. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param build_task_name: The name of the build task that the build corresponds to. - :type build_task_name: str - """ - - _attribute_map = { - 'build_id': {'key': 'buildId', 'type': 'str'}, - 'build_type': {'key': 'buildType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'create_time': {'key': 'createTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'output_image_manifests': {'key': 'outputImageManifests', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'build_task_name': {'key': 'buildTaskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildFilter, self).__init__(**kwargs) - self.build_id = kwargs.get('build_id', None) - self.build_type = kwargs.get('build_type', None) - self.status = kwargs.get('status', None) - self.create_time = kwargs.get('create_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_image_manifests = kwargs.get('output_image_manifests', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - self.build_task_name = kwargs.get('build_task_name', None) - - -class BuildGetLogResult(msrest.serialization.Model): - """The result of get log link operation. - - :param log_link: The link to logs for a azure container registry build. - :type log_link: str - """ - - _attribute_map = { - 'log_link': {'key': 'logLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildGetLogResult, self).__init__(**kwargs) - self.log_link = kwargs.get('log_link', None) - - -class BuildListResult(msrest.serialization.Model): - """Collection of builds. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Build]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BuildStep(ProxyResource): - """Build step resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param properties: The properties of a build step. - :type properties: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BuildStepProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildStep, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class BuildStepList(msrest.serialization.Model): - """The collection of build items. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildStep]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildStepList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BuildStepProperties(msrest.serialization.Model): - """Base properties for any build step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStep. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar provisioning_state: The provisioning state of the build step. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStep'} - } - - def __init__( - self, - **kwargs - ): - super(BuildStepProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.type = None # type: Optional[str] - - -class BuildStepPropertiesUpdateParameters(msrest.serialization.Model): - """The properties for updating a build step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStepUpdateParameters. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStepUpdateParameters'} - } - - def __init__( - self, - **kwargs - ): - super(BuildStepPropertiesUpdateParameters, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class BuildStepUpdateParameters(msrest.serialization.Model): - """The parameters for updating a build step. - - :param properties: The properties for updating a build step. - :type properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepPropertiesUpdateParameters - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'BuildStepPropertiesUpdateParameters'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildStepUpdateParameters, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.tags = kwargs.get('tags', None) - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class BuildTask(Resource): - """The build task that has the resource properties and all build items. The build task will have all information to schedule a build against it. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: The provisioning state of the build task. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar creation_date: The creation date of build task. - :vartype creation_date: ~datetime.datetime - :param alias: The alternative updatable name for a build task. - :type alias: str - :param status: The current status of build task. Possible values include: "Disabled", - "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :param source_repository: The properties that describes the source(code) for the build task. - :type source_repository: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryProperties - :param platform: The platform properties against which the build has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param timeout: Build timeout in seconds. - :type timeout: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'source_repository': {'key': 'properties.sourceRepository', 'type': 'SourceRepositoryProperties'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildTask, self).__init__(**kwargs) - self.provisioning_state = None - self.creation_date = None - self.alias = kwargs.get('alias', None) - self.status = kwargs.get('status', None) - self.source_repository = kwargs.get('source_repository', None) - self.platform = kwargs.get('platform', None) - self.timeout = kwargs.get('timeout', 3600) - - -class QueueBuildRequest(msrest.serialization.Model): - """The queue build request parameters. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BuildTaskBuildRequest, QuickBuildRequest. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the build request.Constant filled by server. - :vartype type: str - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'BuildTask': 'BuildTaskBuildRequest', 'QuickBuild': 'QuickBuildRequest'} - } - - def __init__( - self, - **kwargs - ): - super(QueueBuildRequest, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class BuildTaskBuildRequest(QueueBuildRequest): - """The queue build parameters based on a build task. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the build request.Constant filled by server. - :vartype type: str - :param build_task_name: Required. The name of build task against which build has to be queued. - :type build_task_name: str - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'build_task_name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'build_task_name': {'key': 'buildTaskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildTaskBuildRequest, self).__init__(**kwargs) - self.type = 'BuildTask' # type: str - self.build_task_name = kwargs['build_task_name'] - - -class BuildTaskFilter(msrest.serialization.Model): - """The filter that can be used for listing build tasks. - - :param alias: The alternative name for build task. - :type alias: str - """ - - _attribute_map = { - 'alias': {'key': 'alias', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildTaskFilter, self).__init__(**kwargs) - self.alias = kwargs.get('alias', None) - - -class BuildTaskListResult(msrest.serialization.Model): - """The collection of build tasks. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildTask]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildTaskListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BuildTaskUpdateParameters(msrest.serialization.Model): - """The parameters for updating a build task. - - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param alias: The alternative updatable name for a build task. - :type alias: str - :param status: The current status of build task. Possible values include: "Disabled", - "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :param platform: The platform properties against which the build has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param timeout: Build timeout in seconds. - :type timeout: int - :param source_repository: The properties that describes the source(code) for the build task. - :type source_repository: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryUpdateParameters - """ - - _validation = { - 'timeout': {'maximum': 28800, 'minimum': 300}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - 'source_repository': {'key': 'properties.sourceRepository', 'type': 'SourceRepositoryUpdateParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildTaskUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.alias = kwargs.get('alias', None) - self.status = kwargs.get('status', None) - self.platform = kwargs.get('platform', None) - self.timeout = kwargs.get('timeout', None) - self.source_repository = kwargs.get('source_repository', None) - - -class BuildUpdateParameters(msrest.serialization.Model): - """The set of build properties that can be updated. - - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - """ - - _attribute_map = { - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BuildUpdateParameters, self).__init__(**kwargs) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - - -class DockerBuildStep(BuildStepProperties): - """The Docker build step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar provisioning_state: The provisioning state of the build step. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - :param branch: The repository branch name. - :type branch: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source control root. - :type docker_file_path: str - :param context_path: The relative context path for a docker build in the source. - :type context_path: str - :param build_arguments: The custom arguments for building this build step. - :type build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependency] - :param base_image_trigger: The type of the auto trigger for base image dependency updates. - Possible values include: "All", "Runtime", "None". - :type base_image_trigger: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'type': {'required': True, 'readonly': True}, - 'base_image_dependencies': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'build_arguments': {'key': 'buildArguments', 'type': '[BuildArgument]'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStep, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.branch = kwargs.get('branch', None) - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.docker_file_path = kwargs.get('docker_file_path', None) - self.context_path = kwargs.get('context_path', None) - self.build_arguments = kwargs.get('build_arguments', None) - self.base_image_dependencies = None - self.base_image_trigger = kwargs.get('base_image_trigger', None) - - -class DockerBuildStepUpdateParameters(BuildStepPropertiesUpdateParameters): - """The properties for updating a docker build step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - :param branch: The repository branch name. - :type branch: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source control root. - :type docker_file_path: str - :param context_path: The relative context path for a docker build in the source. - :type context_path: str - :param build_arguments: The custom arguments for building this build step. - :type build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :param base_image_trigger: The type of the auto trigger for base image dependency updates. - Possible values include: "All", "Runtime", "None". - :type base_image_trigger: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'build_arguments': {'key': 'buildArguments', 'type': '[BuildArgument]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStepUpdateParameters, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.branch = kwargs.get('branch', None) - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', None) - self.no_cache = kwargs.get('no_cache', None) - self.docker_file_path = kwargs.get('docker_file_path', None) - self.context_path = kwargs.get('context_path', None) - self.build_arguments = kwargs.get('build_arguments', None) - self.base_image_trigger = kwargs.get('base_image_trigger', None) - - -class GitCommitTrigger(msrest.serialization.Model): - """The git commit trigger that caused a build. - - :param id: The unique ID of the trigger. - :type id: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'commit_id': {'key': 'commitId', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch_name': {'key': 'branchName', 'type': 'str'}, - 'provider_type': {'key': 'providerType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitCommitTrigger, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.commit_id = kwargs.get('commit_id', None) - self.repository_url = kwargs.get('repository_url', None) - self.branch_name = kwargs.get('branch_name', None) - self.provider_type = kwargs.get('provider_type', None) - - -class ImageDescriptor(msrest.serialization.Model): - """Properties for a registry image. - - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDescriptor, self).__init__(**kwargs) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class ImageUpdateTrigger(msrest.serialization.Model): - """The image update trigger that caused a build. - - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'images': {'key': 'images', 'type': '[ImageDescriptor]'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageUpdateTrigger, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.images = kwargs.get('images', None) - - -class PlatformProperties(msrest.serialization.Model): - """The platform properties against which the build has to happen. - - All required parameters must be populated in order to send to Azure. - - :param os_type: Required. The operating system type required for the build. Possible values - include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.OsType - :param cpu: The CPU configuration in terms of number of cores required for the build. - :type cpu: int - """ - - _validation = { - 'os_type': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'cpu': {'key': 'cpu', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(PlatformProperties, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.cpu = kwargs.get('cpu', None) - - -class QuickBuildRequest(QueueBuildRequest): - """The queue build request parameters for a quick build. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the build request.Constant filled by server. - :vartype type: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param source_location: Required. The URL(absolute or relative) of the source that needs to be - built. For Docker build, it can be an URL to a tar or github repository as supported by Docker. - If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl - API. - :type source_location: str - :param build_arguments: The collection of build arguments to be used. - :type build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param timeout: Build timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the build will happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'source_location': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - 'docker_file_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'build_arguments': {'key': 'buildArguments', 'type': '[BuildArgument]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuickBuildRequest, self).__init__(**kwargs) - self.type = 'QuickBuild' # type: str - self.image_names = kwargs.get('image_names', None) - self.source_location = kwargs['source_location'] - self.build_arguments = kwargs.get('build_arguments', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.docker_file_path = kwargs['docker_file_path'] - - -class SourceControlAuthInfo(msrest.serialization.Model): - """The authorization properties for accessing the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int - """ - - _validation = { - 'token': {'required': True}, - } - - _attribute_map = { - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlAuthInfo, self).__init__(**kwargs) - self.token_type = kwargs.get('token_type', None) - self.token = kwargs['token'] - self.refresh_token = kwargs.get('refresh_token', None) - self.scope = kwargs.get('scope', None) - self.expires_in = kwargs.get('expires_in', None) - - -class SourceRepositoryProperties(msrest.serialization.Model): - """The properties of the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param source_control_type: Required. The type of source control service. Possible values - include: "Github", "VisualStudioTeamService". - :type source_control_type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param is_commit_trigger_enabled: The value of this property indicates whether the source - control commit trigger is enabled or not. - :type is_commit_trigger_enabled: bool - :param source_control_auth_properties: The authorization properties for accessing the source - code repository. - :type source_control_auth_properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo - """ - - _validation = { - 'source_control_type': {'required': True}, - 'repository_url': {'required': True}, - } - - _attribute_map = { - 'source_control_type': {'key': 'sourceControlType', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'is_commit_trigger_enabled': {'key': 'isCommitTriggerEnabled', 'type': 'bool'}, - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'SourceControlAuthInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceRepositoryProperties, self).__init__(**kwargs) - self.source_control_type = kwargs['source_control_type'] - self.repository_url = kwargs['repository_url'] - self.is_commit_trigger_enabled = kwargs.get('is_commit_trigger_enabled', False) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - - -class SourceRepositoryUpdateParameters(msrest.serialization.Model): - """The properties for updating the source code repository configuration. - - :param source_control_auth_properties: The authorization properties for accessing the source - code repository. - :type source_control_auth_properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo - :param is_commit_trigger_enabled: The value of this property indicates whether the source - control commit trigger is enabled or not. - :type is_commit_trigger_enabled: bool - """ - - _attribute_map = { - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'SourceControlAuthInfo'}, - 'is_commit_trigger_enabled': {'key': 'isCommitTriggerEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceRepositoryUpdateParameters, self).__init__(**kwargs) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - self.is_commit_trigger_enabled = kwargs.get('is_commit_trigger_enabled', None) - - -class SourceUploadDefinition(msrest.serialization.Model): - """The properties of a response to source upload request. - - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent - queue build request. - :type relative_path: str - """ - - _attribute_map = { - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceUploadDefinition, self).__init__(**kwargs) - self.upload_url = kwargs.get('upload_url', None) - self.relative_path = kwargs.get('relative_path', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models_py3.py index 817918be9825..358493b1c917 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models_py3.py @@ -17,18 +17,18 @@ class BaseImageDependency(msrest.serialization.Model): """Properties that describe a base image dependency. - :param type: The type of the base image dependency. Possible values include: "BuildTime", + :ivar type: The type of the base image dependency. Possible values include: "BuildTime", "RunTime". - :type type: str or + :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -49,6 +49,20 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the base image dependency. Possible values include: "BuildTime", + "RunTime". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependencyType + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(BaseImageDependency, self).__init__(**kwargs) self.type = type self.registry = registry @@ -86,6 +100,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -103,39 +119,39 @@ class Build(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param build_id: The unique identifier for the build. - :type build_id: str - :param status: The current status of the build. Possible values include: "Queued", "Started", + :ivar build_id: The unique identifier for the build. + :vartype build_id: str + :ivar status: The current status of the build. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :param last_updated_time: The last updated time for the build. - :type last_updated_time: ~datetime.datetime - :param build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". - :type build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :param create_time: The time the build was created. - :type create_time: ~datetime.datetime - :param start_time: The time the build started. - :type start_time: ~datetime.datetime - :param finish_time: The time the build finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the build. - :type output_images: + :vartype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus + :ivar last_updated_time: The last updated time for the build. + :vartype last_updated_time: ~datetime.datetime + :ivar build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". + :vartype build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType + :ivar create_time: The time the build was created. + :vartype create_time: ~datetime.datetime + :ivar start_time: The time the build started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the build finished. + :vartype finish_time: ~datetime.datetime + :ivar output_images: The list of all images that were generated from the build. + :vartype output_images: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] - :param build_task: The build task with which the build was started. - :type build_task: str - :param image_update_trigger: The image update trigger that caused the build. - :type image_update_trigger: + :ivar build_task: The build task with which the build was started. + :vartype build_task: str + :ivar image_update_trigger: The image update trigger that caused the build. + :vartype image_update_trigger: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageUpdateTrigger - :param git_commit_trigger: The git commit trigger that caused the build. - :type git_commit_trigger: + :ivar git_commit_trigger: The git commit trigger that caused the build. + :vartype git_commit_trigger: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.GitCommitTrigger - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param platform: The platform properties against which the build will happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param provisioning_state: The provisioning state of a build. Possible values include: + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool + :ivar platform: The platform properties against which the build will happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :ivar provisioning_state: The provisioning state of a build. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState """ @@ -184,6 +200,44 @@ def __init__( provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, **kwargs ): + """ + :keyword build_id: The unique identifier for the build. + :paramtype build_id: str + :keyword status: The current status of the build. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus + :keyword last_updated_time: The last updated time for the build. + :paramtype last_updated_time: ~datetime.datetime + :keyword build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". + :paramtype build_type: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType + :keyword create_time: The time the build was created. + :paramtype create_time: ~datetime.datetime + :keyword start_time: The time the build started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the build finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_images: The list of all images that were generated from the build. + :paramtype output_images: + list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] + :keyword build_task: The build task with which the build was started. + :paramtype build_task: str + :keyword image_update_trigger: The image update trigger that caused the build. + :paramtype image_update_trigger: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageUpdateTrigger + :keyword git_commit_trigger: The git commit trigger that caused the build. + :paramtype git_commit_trigger: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.GitCommitTrigger + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + :keyword platform: The platform properties against which the build will happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :keyword provisioning_state: The provisioning state of a build. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState + """ super(Build, self).__init__(**kwargs) self.build_id = build_id self.status = status @@ -206,16 +260,16 @@ class BuildArgument(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the argument. Possible values include: - "DockerBuildArgument". - :type type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentType - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be + :ivar type: Required. The type of the argument. Possible values include: "DockerBuildArgument". + :vartype type: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentType + :ivar name: Required. The name of the argument. + :vartype name: str + :ivar value: Required. The value of the argument. + :vartype value: str + :ivar is_secret: Flag to indicate whether the argument represents a secret and want to be removed from build logs. - :type is_secret: bool + :vartype is_secret: bool """ _validation = { @@ -240,6 +294,19 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword type: Required. The type of the argument. Possible values include: + "DockerBuildArgument". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentType + :keyword name: Required. The name of the argument. + :paramtype name: str + :keyword value: Required. The value of the argument. + :paramtype value: str + :keyword is_secret: Flag to indicate whether the argument represents a secret and want to be + removed from build logs. + :paramtype is_secret: bool + """ super(BuildArgument, self).__init__(**kwargs) self.type = type self.name = name @@ -250,10 +317,10 @@ def __init__( class BuildArgumentList(msrest.serialization.Model): """The list of build arguments for a build step. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -268,6 +335,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(BuildArgumentList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -276,24 +349,24 @@ def __init__( class BuildFilter(msrest.serialization.Model): """Properties that are enabled for Odata querying. - :param build_id: The unique identifier for the build. - :type build_id: str - :param build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". - :type build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :param status: The current status of the build. Possible values include: "Queued", "Started", + :ivar build_id: The unique identifier for the build. + :vartype build_id: str + :ivar build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". + :vartype build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType + :ivar status: The current status of the build. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :param create_time: The create time for a build. - :type create_time: ~datetime.datetime - :param finish_time: The time the build finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated + :vartype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus + :ivar create_time: The create time for a build. + :vartype create_time: ~datetime.datetime + :ivar finish_time: The time the build finished. + :vartype finish_time: ~datetime.datetime + :ivar output_image_manifests: The list of comma-separated image manifests that were generated from the build. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param build_task_name: The name of the build task that the build corresponds to. - :type build_task_name: str + :vartype output_image_manifests: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool + :ivar build_task_name: The name of the build task that the build corresponds to. + :vartype build_task_name: str """ _attribute_map = { @@ -320,6 +393,27 @@ def __init__( build_task_name: Optional[str] = None, **kwargs ): + """ + :keyword build_id: The unique identifier for the build. + :paramtype build_id: str + :keyword build_type: The type of build. Possible values include: "AutoBuild", "QuickBuild". + :paramtype build_type: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType + :keyword status: The current status of the build. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus + :keyword create_time: The create time for a build. + :paramtype create_time: ~datetime.datetime + :keyword finish_time: The time the build finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_image_manifests: The list of comma-separated image manifests that were + generated from the build. + :paramtype output_image_manifests: str + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + :keyword build_task_name: The name of the build task that the build corresponds to. + :paramtype build_task_name: str + """ super(BuildFilter, self).__init__(**kwargs) self.build_id = build_id self.build_type = build_type @@ -334,8 +428,8 @@ def __init__( class BuildGetLogResult(msrest.serialization.Model): """The result of get log link operation. - :param log_link: The link to logs for a azure container registry build. - :type log_link: str + :ivar log_link: The link to logs for a azure container registry build. + :vartype log_link: str """ _attribute_map = { @@ -348,6 +442,10 @@ def __init__( log_link: Optional[str] = None, **kwargs ): + """ + :keyword log_link: The link to logs for a azure container registry build. + :paramtype log_link: str + """ super(BuildGetLogResult, self).__init__(**kwargs) self.log_link = log_link @@ -355,10 +453,10 @@ def __init__( class BuildListResult(msrest.serialization.Model): """Collection of builds. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -373,6 +471,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(BuildListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -389,8 +493,9 @@ class BuildStep(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: The properties of a build step. - :type properties: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepProperties + :ivar properties: The properties of a build step. + :vartype properties: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepProperties """ _validation = { @@ -412,6 +517,11 @@ def __init__( properties: Optional["BuildStepProperties"] = None, **kwargs ): + """ + :keyword properties: The properties of a build step. + :paramtype properties: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepProperties + """ super(BuildStep, self).__init__(**kwargs) self.properties = properties @@ -419,10 +529,10 @@ def __init__( class BuildStepList(msrest.serialization.Model): """The collection of build items. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -437,6 +547,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(BuildStepList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -456,7 +572,7 @@ class BuildStepProperties(msrest.serialization.Model): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker". :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType """ @@ -479,6 +595,8 @@ def __init__( self, **kwargs ): + """ + """ super(BuildStepProperties, self).__init__(**kwargs) self.provisioning_state = None self.type = None # type: Optional[str] @@ -494,7 +612,7 @@ class BuildStepPropertiesUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker". :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType """ @@ -515,6 +633,8 @@ def __init__( self, **kwargs ): + """ + """ super(BuildStepPropertiesUpdateParameters, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -522,11 +642,11 @@ def __init__( class BuildStepUpdateParameters(msrest.serialization.Model): """The parameters for updating a build step. - :param properties: The properties for updating a build step. - :type properties: + :ivar properties: The properties for updating a build step. + :vartype properties: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepPropertiesUpdateParameters - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. The ARM resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -541,6 +661,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword properties: The properties for updating a build step. + :paramtype properties: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepPropertiesUpdateParameters + :keyword tags: A set of tags. The ARM resource tags. + :paramtype tags: dict[str, str] + """ super(BuildStepUpdateParameters, self).__init__(**kwargs) self.properties = properties self.tags = tags @@ -559,11 +686,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -588,6 +715,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -609,29 +743,29 @@ class BuildTask(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar provisioning_state: The provisioning state of the build task. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState :ivar creation_date: The creation date of build task. :vartype creation_date: ~datetime.datetime - :param alias: The alternative updatable name for a build task. - :type alias: str - :param status: The current status of build task. Possible values include: "Disabled", - "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :param source_repository: The properties that describes the source(code) for the build task. - :type source_repository: + :ivar alias: The alternative updatable name for a build task. + :vartype alias: str + :ivar status: The current status of build task. Possible values include: "Disabled", "Enabled". + :vartype status: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus + :ivar source_repository: The properties that describes the source(code) for the build task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryProperties - :param platform: The platform properties against which the build has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param timeout: Build timeout in seconds. - :type timeout: int + :ivar platform: The platform properties against which the build has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :ivar timeout: Build timeout in seconds. + :vartype timeout: int """ _validation = { @@ -671,6 +805,27 @@ def __init__( timeout: Optional[int] = 3600, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword alias: The alternative updatable name for a build task. + :paramtype alias: str + :keyword status: The current status of build task. Possible values include: "Disabled", + "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus + :keyword source_repository: The properties that describes the source(code) for the build task. + :paramtype source_repository: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryProperties + :keyword platform: The platform properties against which the build has to happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :keyword timeout: Build timeout in seconds. + :paramtype timeout: int + """ super(BuildTask, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.creation_date = None @@ -711,6 +866,8 @@ def __init__( self, **kwargs ): + """ + """ super(QueueBuildRequest, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -724,8 +881,8 @@ class BuildTaskBuildRequest(QueueBuildRequest): :ivar type: Required. The type of the build request.Constant filled by server. :vartype type: str - :param build_task_name: Required. The name of build task against which build has to be queued. - :type build_task_name: str + :ivar build_task_name: Required. The name of build task against which build has to be queued. + :vartype build_task_name: str """ _validation = { @@ -744,6 +901,11 @@ def __init__( build_task_name: str, **kwargs ): + """ + :keyword build_task_name: Required. The name of build task against which build has to be + queued. + :paramtype build_task_name: str + """ super(BuildTaskBuildRequest, self).__init__(**kwargs) self.type = 'BuildTask' # type: str self.build_task_name = build_task_name @@ -752,8 +914,8 @@ def __init__( class BuildTaskFilter(msrest.serialization.Model): """The filter that can be used for listing build tasks. - :param alias: The alternative name for build task. - :type alias: str + :ivar alias: The alternative name for build task. + :vartype alias: str """ _attribute_map = { @@ -766,6 +928,10 @@ def __init__( alias: Optional[str] = None, **kwargs ): + """ + :keyword alias: The alternative name for build task. + :paramtype alias: str + """ super(BuildTaskFilter, self).__init__(**kwargs) self.alias = alias @@ -773,10 +939,10 @@ def __init__( class BuildTaskListResult(msrest.serialization.Model): """The collection of build tasks. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -791,6 +957,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(BuildTaskListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -799,19 +971,19 @@ def __init__( class BuildTaskUpdateParameters(msrest.serialization.Model): """The parameters for updating a build task. - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param alias: The alternative updatable name for a build task. - :type alias: str - :param status: The current status of build task. Possible values include: "Disabled", - "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :param platform: The platform properties against which the build has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param timeout: Build timeout in seconds. - :type timeout: int - :param source_repository: The properties that describes the source(code) for the build task. - :type source_repository: + :ivar tags: A set of tags. The ARM resource tags. + :vartype tags: dict[str, str] + :ivar alias: The alternative updatable name for a build task. + :vartype alias: str + :ivar status: The current status of build task. Possible values include: "Disabled", "Enabled". + :vartype status: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus + :ivar platform: The platform properties against which the build has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :ivar timeout: Build timeout in seconds. + :vartype timeout: int + :ivar source_repository: The properties that describes the source(code) for the build task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryUpdateParameters """ @@ -839,6 +1011,24 @@ def __init__( source_repository: Optional["SourceRepositoryUpdateParameters"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The ARM resource tags. + :paramtype tags: dict[str, str] + :keyword alias: The alternative updatable name for a build task. + :paramtype alias: str + :keyword status: The current status of build task. Possible values include: "Disabled", + "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus + :keyword platform: The platform properties against which the build has to happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :keyword timeout: Build timeout in seconds. + :paramtype timeout: int + :keyword source_repository: The properties that describes the source(code) for the build task. + :paramtype source_repository: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryUpdateParameters + """ super(BuildTaskUpdateParameters, self).__init__(**kwargs) self.tags = tags self.alias = alias @@ -851,8 +1041,8 @@ def __init__( class BuildUpdateParameters(msrest.serialization.Model): """The set of build properties that can be updated. - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool """ _attribute_map = { @@ -865,6 +1055,10 @@ def __init__( is_archive_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + """ super(BuildUpdateParameters, self).__init__(**kwargs) self.is_archive_enabled = is_archive_enabled @@ -880,32 +1074,31 @@ class DockerBuildStep(BuildStepProperties): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker". :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - :param branch: The repository branch name. - :type branch: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar branch: The repository branch name. + :vartype branch: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source control root. - :type docker_file_path: str - :param context_path: The relative context path for a docker build in the source. - :type context_path: str - :param build_arguments: The custom arguments for building this build step. - :type build_arguments: + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: The Docker file path relative to the source control root. + :vartype docker_file_path: str + :ivar context_path: The relative context path for a docker build in the source. + :vartype context_path: str + :ivar build_arguments: The custom arguments for building this build step. + :vartype build_arguments: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependency] - :param base_image_trigger: The type of the auto trigger for base image dependency updates. + :ivar base_image_trigger: The type of the auto trigger for base image dependency updates. Possible values include: "All", "Runtime", "None". - :type base_image_trigger: str or + :vartype base_image_trigger: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType """ @@ -942,6 +1135,29 @@ def __init__( base_image_trigger: Optional[Union[str, "BaseImageTriggerType"]] = None, **kwargs ): + """ + :keyword branch: The repository branch name. + :paramtype branch: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: The Docker file path relative to the source control root. + :paramtype docker_file_path: str + :keyword context_path: The relative context path for a docker build in the source. + :paramtype context_path: str + :keyword build_arguments: The custom arguments for building this build step. + :paramtype build_arguments: + list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] + :keyword base_image_trigger: The type of the auto trigger for base image dependency updates. + Possible values include: "All", "Runtime", "None". + :paramtype base_image_trigger: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType + """ super(DockerBuildStep, self).__init__(**kwargs) self.type = 'Docker' # type: str self.branch = branch @@ -962,29 +1178,28 @@ class DockerBuildStepUpdateParameters(BuildStepPropertiesUpdateParameters): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker". :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - :param branch: The repository branch name. - :type branch: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar branch: The repository branch name. + :vartype branch: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source control root. - :type docker_file_path: str - :param context_path: The relative context path for a docker build in the source. - :type context_path: str - :param build_arguments: The custom arguments for building this build step. - :type build_arguments: + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: The Docker file path relative to the source control root. + :vartype docker_file_path: str + :ivar context_path: The relative context path for a docker build in the source. + :vartype context_path: str + :ivar build_arguments: The custom arguments for building this build step. + :vartype build_arguments: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :param base_image_trigger: The type of the auto trigger for base image dependency updates. + :ivar base_image_trigger: The type of the auto trigger for base image dependency updates. Possible values include: "All", "Runtime", "None". - :type base_image_trigger: str or + :vartype base_image_trigger: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType """ @@ -1017,6 +1232,29 @@ def __init__( base_image_trigger: Optional[Union[str, "BaseImageTriggerType"]] = None, **kwargs ): + """ + :keyword branch: The repository branch name. + :paramtype branch: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: The Docker file path relative to the source control root. + :paramtype docker_file_path: str + :keyword context_path: The relative context path for a docker build in the source. + :paramtype context_path: str + :keyword build_arguments: The custom arguments for building this build step. + :paramtype build_arguments: + list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] + :keyword base_image_trigger: The type of the auto trigger for base image dependency updates. + Possible values include: "All", "Runtime", "None". + :paramtype base_image_trigger: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType + """ super(DockerBuildStepUpdateParameters, self).__init__(**kwargs) self.type = 'Docker' # type: str self.branch = branch @@ -1032,16 +1270,16 @@ def __init__( class GitCommitTrigger(msrest.serialization.Model): """The git commit trigger that caused a build. - :param id: The unique ID of the trigger. - :type id: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar commit_id: The unique ID that identifies a commit. + :vartype commit_id: str + :ivar repository_url: The repository URL. + :vartype repository_url: str + :ivar branch_name: The branch name in the repository. + :vartype branch_name: str + :ivar provider_type: The source control provider type. + :vartype provider_type: str """ _attribute_map = { @@ -1062,6 +1300,18 @@ def __init__( provider_type: Optional[str] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword commit_id: The unique ID that identifies a commit. + :paramtype commit_id: str + :keyword repository_url: The repository URL. + :paramtype repository_url: str + :keyword branch_name: The branch name in the repository. + :paramtype branch_name: str + :keyword provider_type: The source control provider type. + :paramtype provider_type: str + """ super(GitCommitTrigger, self).__init__(**kwargs) self.id = id self.commit_id = commit_id @@ -1073,14 +1323,14 @@ def __init__( class ImageDescriptor(msrest.serialization.Model): """Properties for a registry image. - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -1099,6 +1349,16 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(ImageDescriptor, self).__init__(**kwargs) self.registry = registry self.repository = repository @@ -1109,12 +1369,12 @@ def __init__( class ImageUpdateTrigger(msrest.serialization.Model): """The image update trigger that caused a build. - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar timestamp: The timestamp when the image update happened. + :vartype timestamp: ~datetime.datetime + :ivar images: The list of image updates that caused the build. + :vartype images: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] """ _attribute_map = { @@ -1131,6 +1391,15 @@ def __init__( images: Optional[List["ImageDescriptor"]] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword timestamp: The timestamp when the image update happened. + :paramtype timestamp: ~datetime.datetime + :keyword images: The list of image updates that caused the build. + :paramtype images: + list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] + """ super(ImageUpdateTrigger, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -1142,11 +1411,11 @@ class PlatformProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. The operating system type required for the build. Possible values + :ivar os_type: Required. The operating system type required for the build. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.OsType - :param cpu: The CPU configuration in terms of number of cores required for the build. - :type cpu: int + :vartype os_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.OsType + :ivar cpu: The CPU configuration in terms of number of cores required for the build. + :vartype cpu: int """ _validation = { @@ -1165,6 +1434,13 @@ def __init__( cpu: Optional[int] = None, **kwargs ): + """ + :keyword os_type: Required. The operating system type required for the build. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.OsType + :keyword cpu: The CPU configuration in terms of number of cores required for the build. + :paramtype cpu: int + """ super(PlatformProperties, self).__init__(**kwargs) self.os_type = os_type self.cpu = cpu @@ -1179,28 +1455,27 @@ class QuickBuildRequest(QueueBuildRequest): :ivar type: Required. The type of the build request.Constant filled by server. :vartype type: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param source_location: Required. The URL(absolute or relative) of the source that needs to be + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar source_location: Required. The URL(absolute or relative) of the source that needs to be built. For Docker build, it can be an URL to a tar or github repository as supported by Docker. If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl API. - :type source_location: str - :param build_arguments: The collection of build arguments to be used. - :type build_arguments: + :vartype source_location: str + :ivar build_arguments: The collection of build arguments to be used. + :vartype build_arguments: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param timeout: Build timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the build will happen. - :type platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar timeout: Build timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the build will happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :ivar docker_file_path: Required. The Docker file path relative to the source location. + :vartype docker_file_path: str """ _validation = { @@ -1236,6 +1511,32 @@ def __init__( timeout: Optional[int] = 3600, **kwargs ): + """ + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword source_location: Required. The URL(absolute or relative) of the source that needs to + be built. For Docker build, it can be an URL to a tar or github repository as supported by + Docker. + If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl + API. + :paramtype source_location: str + :keyword build_arguments: The collection of build arguments to be used. + :paramtype build_arguments: + list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword timeout: Build timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the build will happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties + :keyword docker_file_path: Required. The Docker file path relative to the source location. + :paramtype docker_file_path: str + """ super(QuickBuildRequest, self).__init__(**kwargs) self.type = 'QuickBuild' # type: str self.image_names = image_names @@ -1253,16 +1554,16 @@ class SourceControlAuthInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int + :ivar token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :vartype token_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.TokenType + :ivar token: Required. The access token used to access the source control provider. + :vartype token: str + :ivar refresh_token: The refresh token used to refresh the access token. + :vartype refresh_token: str + :ivar scope: The scope of the access token. + :vartype scope: str + :ivar expires_in: Time in seconds that the token remains valid. + :vartype expires_in: int """ _validation = { @@ -1287,6 +1588,19 @@ def __init__( expires_in: Optional[int] = None, **kwargs ): + """ + :keyword token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :paramtype token_type: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.TokenType + :keyword token: Required. The access token used to access the source control provider. + :paramtype token: str + :keyword refresh_token: The refresh token used to refresh the access token. + :paramtype refresh_token: str + :keyword scope: The scope of the access token. + :paramtype scope: str + :keyword expires_in: Time in seconds that the token remains valid. + :paramtype expires_in: int + """ super(SourceControlAuthInfo, self).__init__(**kwargs) self.token_type = token_type self.token = token @@ -1300,18 +1614,18 @@ class SourceRepositoryProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_control_type: Required. The type of source control service. Possible values + :ivar source_control_type: Required. The type of source control service. Possible values include: "Github", "VisualStudioTeamService". - :type source_control_type: str or + :vartype source_control_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param is_commit_trigger_enabled: The value of this property indicates whether the source + :ivar repository_url: Required. The full URL to the source code repository. + :vartype repository_url: str + :ivar is_commit_trigger_enabled: The value of this property indicates whether the source control commit trigger is enabled or not. - :type is_commit_trigger_enabled: bool - :param source_control_auth_properties: The authorization properties for accessing the source + :vartype is_commit_trigger_enabled: bool + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository. - :type source_control_auth_properties: + :vartype source_control_auth_properties: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo """ @@ -1336,6 +1650,21 @@ def __init__( source_control_auth_properties: Optional["SourceControlAuthInfo"] = None, **kwargs ): + """ + :keyword source_control_type: Required. The type of source control service. Possible values + include: "Github", "VisualStudioTeamService". + :paramtype source_control_type: str or + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlType + :keyword repository_url: Required. The full URL to the source code repository. + :paramtype repository_url: str + :keyword is_commit_trigger_enabled: The value of this property indicates whether the source + control commit trigger is enabled or not. + :paramtype is_commit_trigger_enabled: bool + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo + """ super(SourceRepositoryProperties, self).__init__(**kwargs) self.source_control_type = source_control_type self.repository_url = repository_url @@ -1346,13 +1675,13 @@ def __init__( class SourceRepositoryUpdateParameters(msrest.serialization.Model): """The properties for updating the source code repository configuration. - :param source_control_auth_properties: The authorization properties for accessing the source + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository. - :type source_control_auth_properties: + :vartype source_control_auth_properties: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo - :param is_commit_trigger_enabled: The value of this property indicates whether the source + :ivar is_commit_trigger_enabled: The value of this property indicates whether the source control commit trigger is enabled or not. - :type is_commit_trigger_enabled: bool + :vartype is_commit_trigger_enabled: bool """ _attribute_map = { @@ -1367,6 +1696,15 @@ def __init__( is_commit_trigger_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo + :keyword is_commit_trigger_enabled: The value of this property indicates whether the source + control commit trigger is enabled or not. + :paramtype is_commit_trigger_enabled: bool + """ super(SourceRepositoryUpdateParameters, self).__init__(**kwargs) self.source_control_auth_properties = source_control_auth_properties self.is_commit_trigger_enabled = is_commit_trigger_enabled @@ -1375,11 +1713,11 @@ def __init__( class SourceUploadDefinition(msrest.serialization.Model): """The properties of a response to source upload request. - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent + :ivar upload_url: The URL where the client can upload the source. + :vartype upload_url: str + :ivar relative_path: The relative path to the source. This is used to submit the subsequent queue build request. - :type relative_path: str + :vartype relative_path: str """ _attribute_map = { @@ -1394,6 +1732,13 @@ def __init__( relative_path: Optional[str] = None, **kwargs ): + """ + :keyword upload_url: The URL where the client can upload the source. + :paramtype upload_url: str + :keyword relative_path: The relative path to the source. This is used to submit the subsequent + queue build request. + :paramtype relative_path: str + """ super(SourceUploadDefinition, self).__init__(**kwargs) self.upload_url = upload_url self.relative_path = relative_path diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_steps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_steps_operations.py index cb8d5fee049b..2ba1719be967 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_steps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_steps_operations.py @@ -5,25 +5,272 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "stepName": _SERIALIZER.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "stepName": _SERIALIZER.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "stepName": _SERIALIZER.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "stepName": _SERIALIZER.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_build_arguments_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}/listBuildArguments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "stepName": _SERIALIZER.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BuildStepsOperations(object): """BuildStepsOperations operations. @@ -47,14 +294,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildStepList"] + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildStepList"]: """List all the build steps for a given build task. :param resource_group_name: The name of the resource group to which the container registry @@ -66,7 +313,8 @@ def list( :type build_task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildStepList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStepList"] @@ -74,37 +322,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildStepList', pipeline_response) + deserialized = self._deserialize("BuildStepList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,20 +368,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildStep" + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + **kwargs: Any + ) -> "_models.BuildStep": """Gets the build step for a build task. :param resource_group_name: The name of the resource group to which the container registry @@ -157,29 +404,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -193,51 +430,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - build_step_create_parameters, # type: "_models.BuildStep" - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildStep" + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + build_step_create_parameters: "_models.BuildStep", + **kwargs: Any + ) -> "_models.BuildStep": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStep"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_step_create_parameters, 'BuildStep') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_step_create_parameters, 'BuildStep') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,18 +483,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - build_step_create_parameters, # type: "_models.BuildStep" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BuildStep"] + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + build_step_create_parameters: "_models.BuildStep", + **kwargs: Any + ) -> LROPoller["_models.BuildStep"]: """Creates a build step for a build task. :param resource_group_name: The name of the resource group to which the container registry @@ -279,18 +509,23 @@ def begin_create( :param step_name: The name of a build step for a container registry build task. :type step_name: str :param build_step_create_parameters: The parameters for creating a build step. - :type build_step_create_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep + :type build_step_create_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either BuildStep or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStep"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,29 +539,21 @@ def begin_create( build_task_name=build_task_name, step_name=step_name, build_step_create_parameters=build_step_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildStep', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -338,43 +565,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -387,15 +606,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a build step from the build task. :param resource_group_name: The name of the resource group to which the container registry @@ -409,15 +629,17 @@ def begin_delete( :type step_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -433,23 +655,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -461,51 +674,41 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - build_step_update_parameters, # type: "_models.BuildStepUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildStep" + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + build_step_update_parameters: "_models.BuildStepUpdateParameters", + **kwargs: Any + ) -> "_models.BuildStep": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStep"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_step_update_parameters, 'BuildStepUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_step_update_parameters, 'BuildStepUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -523,18 +726,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - build_step_update_parameters, # type: "_models.BuildStepUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BuildStep"] + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + build_step_update_parameters: "_models.BuildStepUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.BuildStep"]: """Updates a build step in a build task. :param resource_group_name: The name of the resource group to which the container registry @@ -547,18 +752,23 @@ def begin_update( :param step_name: The name of a build step for a container registry build task. :type step_name: str :param build_step_update_parameters: The parameters for updating a build step. - :type build_step_update_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters + :type build_step_update_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either BuildStep or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildStep"] lro_delay = kwargs.pop( 'polling_interval', @@ -572,29 +782,21 @@ def begin_update( build_task_name=build_task_name, step_name=step_name, build_step_update_parameters=build_step_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildStep', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -606,17 +808,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}'} # type: ignore + @distributed_trace def list_build_arguments( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - step_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildArgumentList"] + resource_group_name: str, + registry_name: str, + build_task_name: str, + step_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildArgumentList"]: """List the build arguments for a step including the secret arguments. :param resource_group_name: The name of the resource group to which the container registry @@ -630,7 +833,8 @@ def list_build_arguments( :type step_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildArgumentList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildArgumentList"] @@ -638,38 +842,37 @@ def list_build_arguments( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_build_arguments.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'stepName': self._serialize.url("step_name", step_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_build_arguments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=self.list_build_arguments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_arguments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + step_name=step_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildArgumentList', pipeline_response) + deserialized = self._deserialize("BuildArgumentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -687,6 +890,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_tasks_operations.py index 1ccf29001c01..d310f26282b0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_tasks_operations.py @@ -5,25 +5,267 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_source_repository_properties_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildTaskName": _SERIALIZER.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BuildTasksOperations(object): """BuildTasksOperations operations. @@ -47,15 +289,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildTaskListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.BuildTaskListResult"]: """Lists all the build tasks for a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -70,7 +312,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildTaskListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTaskListResult"] @@ -78,40 +321,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildTaskListResult', pipeline_response) + deserialized = self._deserialize("BuildTaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,19 +369,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildTask" + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any + ) -> "_models.BuildTask": """Get the properties of a specified build task. :param resource_group_name: The name of the resource group to which the container registry @@ -161,28 +402,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,49 +427,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - build_task_create_parameters, # type: "_models.BuildTask" - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildTask" + resource_group_name: str, + registry_name: str, + build_task_name: str, + build_task_create_parameters: "_models.BuildTask", + **kwargs: Any + ) -> "_models.BuildTask": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTask"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_task_create_parameters, 'BuildTask') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_task_create_parameters, 'BuildTask') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -256,17 +478,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - build_task_create_parameters, # type: "_models.BuildTask" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BuildTask"] + resource_group_name: str, + registry_name: str, + build_task_name: str, + build_task_create_parameters: "_models.BuildTask", + **kwargs: Any + ) -> LROPoller["_models.BuildTask"]: """Creates a build task for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -277,18 +501,23 @@ def begin_create( :param build_task_name: The name of the container registry build task. :type build_task_name: str :param build_task_create_parameters: The parameters for creating a build task. - :type build_task_create_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask + :type build_task_create_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either BuildTask or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTask"] lro_delay = kwargs.pop( 'polling_interval', @@ -301,28 +530,21 @@ def begin_create( registry_name=registry_name, build_task_name=build_task_name, build_task_create_parameters=build_task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildTask', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -334,41 +556,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,14 +595,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified build task. :param resource_group_name: The name of the resource group to which the container registry @@ -400,15 +615,17 @@ def begin_delete( :type build_task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -423,22 +640,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -450,49 +659,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - build_task_update_parameters, # type: "_models.BuildTaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildTask" + resource_group_name: str, + registry_name: str, + build_task_name: str, + build_task_update_parameters: "_models.BuildTaskUpdateParameters", + **kwargs: Any + ) -> "_models.BuildTask": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTask"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build_task_update_parameters, 'BuildTaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_task_update_parameters, 'BuildTaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,17 +709,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - build_task_update_parameters, # type: "_models.BuildTaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BuildTask"] + resource_group_name: str, + registry_name: str, + build_task_name: str, + build_task_update_parameters: "_models.BuildTaskUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.BuildTask"]: """Updates a build task with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -531,18 +732,23 @@ def begin_update( :param build_task_name: The name of the container registry build task. :type build_task_name: str :param build_task_update_parameters: The parameters for updating a build task. - :type build_task_update_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters + :type build_task_update_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either BuildTask or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildTask"] lro_delay = kwargs.pop( 'polling_interval', @@ -555,28 +761,21 @@ def begin_update( registry_name=registry_name, build_task_name=build_task_name, build_task_update_parameters=build_task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildTask', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,16 +787,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}'} # type: ignore + @distributed_trace def list_source_repository_properties( self, - resource_group_name, # type: str - registry_name, # type: str - build_task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceRepositoryProperties" + resource_group_name: str, + registry_name: str, + build_task_name: str, + **kwargs: Any + ) -> "_models.SourceRepositoryProperties": """Get the source control properties for a build task. :param resource_group_name: The name of the resource group to which the container registry @@ -617,28 +817,18 @@ def list_source_repository_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_source_repository_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildTaskName': self._serialize.url("build_task_name", build_task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_source_repository_properties_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_task_name=build_task_name, + template_url=self.list_source_repository_properties.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -652,4 +842,6 @@ def list_source_repository_properties( return cls(pipeline_response, deserialized, {}) return deserialized + list_source_repository_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_builds_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_builds_operations.py index e55f5bfc9813..07cb9f9410d9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_builds_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_builds_operations.py @@ -5,25 +5,224 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildId": _SERIALIZER.url("build_id", build_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildId": _SERIALIZER.url("build_id", build_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_log_link_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildId": _SERIALIZER.url("build_id", build_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_cancel_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + build_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "buildId": _SERIALIZER.url("build_id", build_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class BuildsOperations(object): """BuildsOperations operations. @@ -47,16 +246,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.BuildListResult"]: """Gets all the builds for a registry. :param resource_group_name: The name of the resource group to which the container registry @@ -74,7 +273,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildListResult"] @@ -82,42 +282,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildListResult', pipeline_response) + deserialized = self._deserialize("BuildListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,19 +332,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - build_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Build" + resource_group_name: str, + registry_name: str, + build_id: str, + **kwargs: Any + ) -> "_models.Build": """Gets the detailed information for a given build. :param resource_group_name: The name of the resource group to which the container registry @@ -167,28 +365,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,49 +390,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_id, # type: str - build_update_parameters, # type: "_models.BuildUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Build" + resource_group_name: str, + registry_name: str, + build_id: str, + build_update_parameters: "_models.BuildUpdateParameters", + **kwargs: Any + ) -> "_models.Build": cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_update_parameters, 'BuildUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_update_parameters, 'BuildUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,17 +441,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - build_id, # type: str - build_update_parameters, # type: "_models.BuildUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Build"] + resource_group_name: str, + registry_name: str, + build_id: str, + build_update_parameters: "_models.BuildUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Build"]: """Patch the build properties. :param resource_group_name: The name of the resource group to which the container registry @@ -283,18 +464,23 @@ def begin_update( :param build_id: The build ID. :type build_id: str :param build_update_parameters: The build update properties. - :type build_update_parameters: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters + :type build_update_parameters: + ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Build or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,28 +493,21 @@ def begin_update( registry_name=registry_name, build_id=build_id, build_update_parameters=build_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Build', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,16 +519,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}'} # type: ignore + @distributed_trace def get_log_link( self, - resource_group_name, # type: str - registry_name, # type: str - build_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildGetLogResult" + resource_group_name: str, + registry_name: str, + build_id: str, + **kwargs: Any + ) -> "_models.BuildGetLogResult": """Gets a link to download the build logs. :param resource_group_name: The name of the resource group to which the container registry @@ -369,28 +549,18 @@ def get_log_link( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_link.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_link_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + template_url=self.get_log_link.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -404,41 +574,34 @@ def get_log_link( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink'} # type: ignore + def _cancel_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + build_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + build_id=build_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -451,14 +614,15 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - registry_name, # type: str - build_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + build_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancel an existing build. :param resource_group_name: The name of the resource group to which the container registry @@ -470,15 +634,17 @@ def begin_cancel( :type build_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -493,22 +659,14 @@ def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'buildId': self._serialize.url("build_id", build_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -520,4 +678,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_registries_operations.py index 3e253e9e123f..4220d35313cf 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_registries_operations.py @@ -5,24 +5,106 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_queue_build_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_build_source_upload_url_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -48,43 +130,32 @@ def __init__(self, client, config, serializer, deserializer): def _queue_build_initial( self, - resource_group_name, # type: str - registry_name, # type: str - build_request, # type: "_models.QueueBuildRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Build"] + resource_group_name: str, + registry_name: str, + build_request: "_models.QueueBuildRequest", + **kwargs: Any + ) -> Optional["_models.Build"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Build"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._queue_build_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(build_request, 'QueueBuildRequest') + + request = build_queue_build_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._queue_build_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build_request, 'QueueBuildRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,16 +171,18 @@ def _queue_build_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _queue_build_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild'} # type: ignore + + @distributed_trace def begin_queue_build( self, - resource_group_name, # type: str - registry_name, # type: str - build_request, # type: "_models.QueueBuildRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Build"] + resource_group_name: str, + registry_name: str, + build_request: "_models.QueueBuildRequest", + **kwargs: Any + ) -> LROPoller["_models.Build"]: """Creates a new build based on the request parameters and add it to the build queue. :param resource_group_name: The name of the resource group to which the container registry @@ -121,15 +194,19 @@ def begin_queue_build( :type build_request: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.QueueBuildRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Build or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +218,21 @@ def begin_queue_build( resource_group_name=resource_group_name, registry_name=registry_name, build_request=build_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Build', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,15 +244,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_queue_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild'} # type: ignore + @distributed_trace def get_build_source_upload_url( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceUploadDefinition" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.SourceUploadDefinition": """Get the upload location for the user to be able to upload the source. :param resource_group_name: The name of the resource group to which the container registry @@ -199,27 +271,17 @@ def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,4 +295,6 @@ def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_configuration.py index 9c2867e2d1ec..66d249351963 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_container_registry_management_client.py index 8ad1d5d793e9..d1581b9505a3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_container_registry_management_client.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import RegistriesOperations, RunsOperations, TasksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import RunsOperations -from .operations import TasksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations @@ -38,52 +34,56 @@ class ContainerRegistryManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.runs = RunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_metadata.json index 12fd9e1f4db9..1a729c6ed131 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "registries": "RegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_configuration.py index fcd824d76aa6..a89e34bf5644 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_container_registry_management_client.py index cf0170070cf3..bd2af7a236db 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_container_registry_management_client.py @@ -6,28 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import RegistriesOperations, RunsOperations, TasksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import RunsOperations -from .operations import TasksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2018_09_01.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2018_09_01.aio.operations.RegistriesOperations :ivar runs: RunsOperations operations :vartype runs: azure.mgmt.containerregistry.v2018_09_01.aio.operations.RunsOperations :ivar tasks: TasksOperations operations @@ -36,50 +35,56 @@ class ContainerRegistryManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.runs = RunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_registries_operations.py index d3157a34380e..fea8bf9ced71 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_registries_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_get_build_source_upload_url_request, build_schedule_run_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,32 +58,22 @@ async def _schedule_run_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._schedule_run_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_request, 'RunRequest') + + request = build_schedule_run_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._schedule_run_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_request, 'RunRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,8 +89,11 @@ async def _schedule_run_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _schedule_run_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + + @distributed_trace_async async def begin_schedule_run( self, resource_group_name: str, @@ -115,15 +112,19 @@ async def begin_schedule_run( :type run_request: ~azure.mgmt.containerregistry.v2018_09_01.models.RunRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,27 +136,21 @@ async def begin_schedule_run( resource_group_name=resource_group_name, registry_name=registry_name, run_request=run_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,8 +162,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_schedule_run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + @distributed_trace_async async def get_build_source_upload_url( self, resource_group_name: str, @@ -192,27 +189,17 @@ async def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,4 +213,6 @@ async def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_runs_operations.py index 9b321a6cc106..ba035f4f6cd0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runs_operations import build_cancel_request_initial, build_get_log_sas_url_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,7 +73,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.RunListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.RunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunListResult"] @@ -75,40 +82,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunListResult', pipeline_response) + deserialized = self._deserialize("RunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,11 +130,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -157,28 +163,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,8 +188,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -207,33 +205,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_update_parameters, 'RunUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_update_parameters, 'RunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,8 +239,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -271,18 +262,23 @@ async def begin_update( :param run_id: The run ID. :type run_id: str :param run_update_parameters: The run update properties. - :type run_update_parameters: ~azure.mgmt.containerregistry.v2018_09_01.models.RunUpdateParameters + :type run_update_parameters: + ~azure.mgmt.containerregistry.v2018_09_01.models.RunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +291,21 @@ async def begin_update( registry_name=registry_name, run_id=run_id, run_update_parameters=run_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -328,8 +317,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + @distributed_trace_async async def get_log_sas_url( self, resource_group_name: str, @@ -356,28 +347,18 @@ async def get_log_sas_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_sas_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_sas_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get_log_sas_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,8 +372,10 @@ async def get_log_sas_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_sas_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl'} # type: ignore + async def _cancel_initial( self, resource_group_name: str, @@ -405,26 +388,18 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,6 +412,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -455,15 +432,17 @@ async def begin_cancel( :type run_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -478,22 +457,14 @@ async def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -505,4 +476,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_tasks_operations.py index b3bd4cb7c6e5..607fe16861ca 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_tasks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tasks_operations import build_create_request_initial, build_delete_request_initial, build_get_details_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.TaskListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.TaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskListResult"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TaskListResult', pipeline_response) + deserialized = self._deserialize("TaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +150,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +175,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +192,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(task_create_parameters, 'Task') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_create_parameters, 'Task') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +226,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,15 +252,19 @@ async def begin_create( :type task_create_parameters: ~azure.mgmt.containerregistry.v2018_09_01.models.Task :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +277,21 @@ async def begin_create( registry_name=registry_name, task_name=task_name, task_create_parameters=task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore async def _delete_initial( @@ -329,26 +318,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +342,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +362,17 @@ async def begin_delete( :type task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +406,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore async def _update_initial( @@ -444,33 +422,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,8 +456,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -508,18 +479,23 @@ async def begin_update( :param task_name: The name of the container registry task. :type task_name: str :param task_update_parameters: The parameters for updating a task. - :type task_update_parameters: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskUpdateParameters + :type task_update_parameters: + ~azure.mgmt.containerregistry.v2018_09_01.models.TaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -532,28 +508,21 @@ async def begin_update( registry_name=registry_name, task_name=task_name, task_update_parameters=task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -565,8 +534,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + @distributed_trace_async async def get_details( self, resource_group_name: str, @@ -593,28 +564,18 @@ async def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,4 +589,6 @@ async def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/__init__.py index 32e7df427c64..e991bd15594a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/__init__.py @@ -6,102 +6,54 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AgentProperties - from ._models_py3 import Argument - from ._models_py3 import AuthInfo - from ._models_py3 import AuthInfoUpdateParameters - from ._models_py3 import BaseImageDependency - from ._models_py3 import BaseImageTrigger - from ._models_py3 import BaseImageTriggerUpdateParameters - from ._models_py3 import Credentials - from ._models_py3 import CustomRegistryCredentials - from ._models_py3 import DockerBuildRequest - from ._models_py3 import DockerBuildStep - from ._models_py3 import DockerBuildStepUpdateParameters - from ._models_py3 import EncodedTaskRunRequest - from ._models_py3 import EncodedTaskStep - from ._models_py3 import EncodedTaskStepUpdateParameters - from ._models_py3 import FileTaskRunRequest - from ._models_py3 import FileTaskStep - from ._models_py3 import FileTaskStepUpdateParameters - from ._models_py3 import ImageDescriptor - from ._models_py3 import ImageUpdateTrigger - from ._models_py3 import PlatformProperties - from ._models_py3 import PlatformUpdateParameters - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import Run - from ._models_py3 import RunFilter - from ._models_py3 import RunGetLogResult - from ._models_py3 import RunListResult - from ._models_py3 import RunRequest - from ._models_py3 import RunUpdateParameters - from ._models_py3 import SecretObject - from ._models_py3 import SetValue - from ._models_py3 import SourceProperties - from ._models_py3 import SourceRegistryCredentials - from ._models_py3 import SourceTrigger - from ._models_py3 import SourceTriggerDescriptor - from ._models_py3 import SourceTriggerUpdateParameters - from ._models_py3 import SourceUpdateParameters - from ._models_py3 import SourceUploadDefinition - from ._models_py3 import Task - from ._models_py3 import TaskListResult - from ._models_py3 import TaskRunRequest - from ._models_py3 import TaskStepProperties - from ._models_py3 import TaskStepUpdateParameters - from ._models_py3 import TaskUpdateParameters - from ._models_py3 import TriggerProperties - from ._models_py3 import TriggerUpdateParameters -except (SyntaxError, ImportError): - from ._models import AgentProperties # type: ignore - from ._models import Argument # type: ignore - from ._models import AuthInfo # type: ignore - from ._models import AuthInfoUpdateParameters # type: ignore - from ._models import BaseImageDependency # type: ignore - from ._models import BaseImageTrigger # type: ignore - from ._models import BaseImageTriggerUpdateParameters # type: ignore - from ._models import Credentials # type: ignore - from ._models import CustomRegistryCredentials # type: ignore - from ._models import DockerBuildRequest # type: ignore - from ._models import DockerBuildStep # type: ignore - from ._models import DockerBuildStepUpdateParameters # type: ignore - from ._models import EncodedTaskRunRequest # type: ignore - from ._models import EncodedTaskStep # type: ignore - from ._models import EncodedTaskStepUpdateParameters # type: ignore - from ._models import FileTaskRunRequest # type: ignore - from ._models import FileTaskStep # type: ignore - from ._models import FileTaskStepUpdateParameters # type: ignore - from ._models import ImageDescriptor # type: ignore - from ._models import ImageUpdateTrigger # type: ignore - from ._models import PlatformProperties # type: ignore - from ._models import PlatformUpdateParameters # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import Run # type: ignore - from ._models import RunFilter # type: ignore - from ._models import RunGetLogResult # type: ignore - from ._models import RunListResult # type: ignore - from ._models import RunRequest # type: ignore - from ._models import RunUpdateParameters # type: ignore - from ._models import SecretObject # type: ignore - from ._models import SetValue # type: ignore - from ._models import SourceProperties # type: ignore - from ._models import SourceRegistryCredentials # type: ignore - from ._models import SourceTrigger # type: ignore - from ._models import SourceTriggerDescriptor # type: ignore - from ._models import SourceTriggerUpdateParameters # type: ignore - from ._models import SourceUpdateParameters # type: ignore - from ._models import SourceUploadDefinition # type: ignore - from ._models import Task # type: ignore - from ._models import TaskListResult # type: ignore - from ._models import TaskRunRequest # type: ignore - from ._models import TaskStepProperties # type: ignore - from ._models import TaskStepUpdateParameters # type: ignore - from ._models import TaskUpdateParameters # type: ignore - from ._models import TriggerProperties # type: ignore - from ._models import TriggerUpdateParameters # type: ignore +from ._models_py3 import AgentProperties +from ._models_py3 import Argument +from ._models_py3 import AuthInfo +from ._models_py3 import AuthInfoUpdateParameters +from ._models_py3 import BaseImageDependency +from ._models_py3 import BaseImageTrigger +from ._models_py3 import BaseImageTriggerUpdateParameters +from ._models_py3 import Credentials +from ._models_py3 import CustomRegistryCredentials +from ._models_py3 import DockerBuildRequest +from ._models_py3 import DockerBuildStep +from ._models_py3 import DockerBuildStepUpdateParameters +from ._models_py3 import EncodedTaskRunRequest +from ._models_py3 import EncodedTaskStep +from ._models_py3 import EncodedTaskStepUpdateParameters +from ._models_py3 import FileTaskRunRequest +from ._models_py3 import FileTaskStep +from ._models_py3 import FileTaskStepUpdateParameters +from ._models_py3 import ImageDescriptor +from ._models_py3 import ImageUpdateTrigger +from ._models_py3 import PlatformProperties +from ._models_py3 import PlatformUpdateParameters +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import Run +from ._models_py3 import RunFilter +from ._models_py3 import RunGetLogResult +from ._models_py3 import RunListResult +from ._models_py3 import RunRequest +from ._models_py3 import RunUpdateParameters +from ._models_py3 import SecretObject +from ._models_py3 import SetValue +from ._models_py3 import SourceProperties +from ._models_py3 import SourceRegistryCredentials +from ._models_py3 import SourceTrigger +from ._models_py3 import SourceTriggerDescriptor +from ._models_py3 import SourceTriggerUpdateParameters +from ._models_py3 import SourceUpdateParameters +from ._models_py3 import SourceUploadDefinition +from ._models_py3 import Task +from ._models_py3 import TaskListResult +from ._models_py3 import TaskRunRequest +from ._models_py3 import TaskStepProperties +from ._models_py3 import TaskStepUpdateParameters +from ._models_py3 import TaskUpdateParameters +from ._models_py3 import TriggerProperties +from ._models_py3 import TriggerUpdateParameters + from ._container_registry_management_client_enums import ( Architecture, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_container_registry_management_client_enums.py index 125a6d4bb63d..738fbc0f2115 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_container_registry_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Architecture(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Architecture(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS architecture. """ @@ -34,28 +19,28 @@ class Architecture(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): X86 = "x86" ARM = "arm" -class BaseImageDependencyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageDependencyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the base image dependency. """ BUILD_TIME = "BuildTime" RUN_TIME = "RunTime" -class BaseImageTriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageTriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the auto trigger for base image dependency updates. """ ALL = "All" RUNTIME = "Runtime" -class OS(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OS(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system type required for the run. """ WINDOWS = "Windows" LINUX = "Linux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of a run. """ @@ -66,7 +51,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class RunStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RunStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the run. """ @@ -79,7 +64,7 @@ class RunStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" TIMEOUT = "Timeout" -class RunType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RunType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of run. """ @@ -88,21 +73,21 @@ class RunType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_BUILD = "AutoBuild" AUTO_RUN = "AutoRun" -class SecretObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretObjectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the secret object which determines how the value of the secret object has to be interpreted. """ OPAQUE = "Opaque" -class SourceControlType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceControlType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source control service. """ GITHUB = "Github" VISUAL_STUDIO_TEAM_SERVICE = "VisualStudioTeamService" -class SourceRegistryLoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceRegistryLoginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication mode which determines the source registry login scope. The credentials for the source registry will be generated using the given scope. These credentials will be used to login to @@ -112,12 +97,12 @@ class SourceRegistryLoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum NONE = "None" DEFAULT = "Default" -class SourceTriggerEvent(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceTriggerEvent(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COMMIT = "commit" PULLREQUEST = "pullrequest" -class StepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StepType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the step. """ @@ -125,28 +110,28 @@ class StepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_TASK = "FileTask" ENCODED_TASK = "EncodedTask" -class TaskStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TaskStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of task. """ DISABLED = "Disabled" ENABLED = "Enabled" -class TokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Auth token. """ PAT = "PAT" O_AUTH = "OAuth" -class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of trigger. """ DISABLED = "Disabled" ENABLED = "Enabled" -class Variant(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Variant(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Variant of the CPU. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models.py deleted file mode 100644 index 6a6016f76faa..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models.py +++ /dev/null @@ -1,1969 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AgentProperties(msrest.serialization.Model): - """The properties that determine the run agent configuration. - - :param cpu: The CPU configuration in terms of number of cores required for the run. - :type cpu: int - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentProperties, self).__init__(**kwargs) - self.cpu = kwargs.get('cpu', None) - - -class Argument(msrest.serialization.Model): - """The properties of a run argument. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be - removed from build logs. - :type is_secret: bool - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'is_secret': {'key': 'isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Argument, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - self.is_secret = kwargs.get('is_secret', False) - - -class AuthInfo(msrest.serialization.Model): - """The authorization properties for accessing the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int - """ - - _validation = { - 'token_type': {'required': True}, - 'token': {'required': True}, - } - - _attribute_map = { - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AuthInfo, self).__init__(**kwargs) - self.token_type = kwargs['token_type'] - self.token = kwargs['token'] - self.refresh_token = kwargs.get('refresh_token', None) - self.scope = kwargs.get('scope', None) - self.expires_in = kwargs.get('expires_in', None) - - -class AuthInfoUpdateParameters(msrest.serialization.Model): - """The authorization properties for accessing the source code repository. - - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType - :param token: The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int - """ - - _attribute_map = { - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AuthInfoUpdateParameters, self).__init__(**kwargs) - self.token_type = kwargs.get('token_type', None) - self.token = kwargs.get('token', None) - self.refresh_token = kwargs.get('refresh_token', None) - self.scope = kwargs.get('scope', None) - self.expires_in = kwargs.get('expires_in', None) - - -class BaseImageDependency(msrest.serialization.Model): - """Properties that describe a base image dependency. - - :param type: The type of the base image dependency. Possible values include: "BuildTime", - "RunTime". - :type type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageDependency, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class BaseImageTrigger(msrest.serialization.Model): - """The trigger based on base image dependency. - - All required parameters must be populated in order to send to Azure. - - :param base_image_trigger_type: Required. The type of the auto trigger for base image - dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or - ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'base_image_trigger_type': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'base_image_trigger_type': {'key': 'baseImageTriggerType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageTrigger, self).__init__(**kwargs) - self.base_image_trigger_type = kwargs['base_image_trigger_type'] - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class BaseImageTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating base image dependency trigger. - - All required parameters must be populated in order to send to Azure. - - :param base_image_trigger_type: The type of the auto trigger for base image dependency updates. - Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or - ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'base_image_trigger_type': {'key': 'baseImageTriggerType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageTriggerUpdateParameters, self).__init__(**kwargs) - self.base_image_trigger_type = kwargs.get('base_image_trigger_type', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class Credentials(msrest.serialization.Model): - """The parameters that describes a set of credentials that will be used when a run is invoked. - - :param source_registry: Describes the credential parameters for accessing the source registry. - :type source_registry: - ~azure.mgmt.containerregistry.v2018_09_01.models.SourceRegistryCredentials - :param custom_registries: Describes the credential parameters for accessing other custom - registries. The key - for the dictionary item will be the registry login server (myregistry.azurecr.io) and - the value of the item will be the registry credentials for accessing the registry. - :type custom_registries: dict[str, - ~azure.mgmt.containerregistry.v2018_09_01.models.CustomRegistryCredentials] - """ - - _attribute_map = { - 'source_registry': {'key': 'sourceRegistry', 'type': 'SourceRegistryCredentials'}, - 'custom_registries': {'key': 'customRegistries', 'type': '{CustomRegistryCredentials}'}, - } - - def __init__( - self, - **kwargs - ): - super(Credentials, self).__init__(**kwargs) - self.source_registry = kwargs.get('source_registry', None) - self.custom_registries = kwargs.get('custom_registries', None) - - -class CustomRegistryCredentials(msrest.serialization.Model): - """Describes the credentials that will be used to access a custom registry during a run. - - :param user_name: The username for logging into the custom registry. - :type user_name: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject - :param password: The password for logging into the custom registry. The password is a secret - object that allows multiple ways of providing the value for it. - :type password: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject - """ - - _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'SecretObject'}, - 'password': {'key': 'password', 'type': 'SecretObject'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomRegistryCredentials, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.password = kwargs.get('password', None) - - -class RunRequest(msrest.serialization.Model): - """The request parameters for scheduling a run. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildRequest, EncodedTaskRunRequest, FileTaskRunRequest, TaskRunRequest. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the run request.Constant filled by server. - :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - } - - _subtype_map = { - 'type': {'DockerBuildRequest': 'DockerBuildRequest', 'EncodedTaskRunRequest': 'EncodedTaskRunRequest', 'FileTaskRunRequest': 'FileTaskRunRequest', 'TaskRunRequest': 'TaskRunRequest'} - } - - def __init__( - self, - **kwargs - ): - super(RunRequest, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.is_archive_enabled = kwargs.get('is_archive_enabled', False) - - -class DockerBuildRequest(RunRequest): - """The parameters for a docker quick build. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the run request.Constant filled by server. - :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing the run. - :type arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'docker_file_path': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildRequest, self).__init__(**kwargs) - self.type = 'DockerBuildRequest' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.docker_file_path = kwargs['docker_file_path'] - self.target = kwargs.get('target', None) - self.arguments = kwargs.get('arguments', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class TaskStepProperties(msrest.serialization.Model): - """Base properties for any task step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStep, EncodedTaskStep, FileTaskStep. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'base_image_dependencies': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStep', 'EncodedTask': 'EncodedTaskStep', 'FileTask': 'FileTaskStep'} - } - - def __init__( - self, - **kwargs - ): - super(TaskStepProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.base_image_dependencies = None - self.context_path = kwargs.get('context_path', None) - self.context_access_token = kwargs.get('context_access_token', None) - - -class DockerBuildStep(TaskStepProperties): - """The Docker build step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source context. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing this build - step. - :type arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'base_image_dependencies': {'readonly': True}, - 'docker_file_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStep, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.docker_file_path = kwargs['docker_file_path'] - self.target = kwargs.get('target', None) - self.arguments = kwargs.get('arguments', None) - - -class TaskStepUpdateParameters(msrest.serialization.Model): - """Base properties for updating any task step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStepUpdateParameters, EncodedTaskStepUpdateParameters, FileTaskStepUpdateParameters. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStepUpdateParameters', 'EncodedTask': 'EncodedTaskStepUpdateParameters', 'FileTask': 'FileTaskStepUpdateParameters'} - } - - def __init__( - self, - **kwargs - ): - super(TaskStepUpdateParameters, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.context_path = kwargs.get('context_path', None) - self.context_access_token = kwargs.get('context_access_token', None) - - -class DockerBuildStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating a docker build step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source context. - :type docker_file_path: str - :param arguments: The collection of override arguments to be used when executing this build - step. - :type arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStepUpdateParameters, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', None) - self.no_cache = kwargs.get('no_cache', None) - self.docker_file_path = kwargs.get('docker_file_path', None) - self.arguments = kwargs.get('arguments', None) - self.target = kwargs.get('target', None) - - -class EncodedTaskRunRequest(RunRequest): - """The parameters for a quick task run request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the run request.Constant filled by server. - :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param encoded_task_content: Required. Base64 encoded value of the template/definition file - content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'encoded_task_content': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskRunRequest, self).__init__(**kwargs) - self.type = 'EncodedTaskRunRequest' # type: str - self.encoded_task_content = kwargs['encoded_task_content'] - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class EncodedTaskStep(TaskStepProperties): - """The properties of a encoded task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file - content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'base_image_dependencies': {'readonly': True}, - 'encoded_task_content': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskStep, self).__init__(**kwargs) - self.type = 'EncodedTask' # type: str - self.encoded_task_content = kwargs['encoded_task_content'] - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - - -class EncodedTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating encoded task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskStepUpdateParameters, self).__init__(**kwargs) - self.type = 'EncodedTask' # type: str - self.encoded_task_content = kwargs.get('encoded_task_content', None) - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - - -class FileTaskRunRequest(RunRequest): - """The request parameters for a scheduling run against a task file. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the run request.Constant filled by server. - :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param task_file_path: Required. The template/definition file path relative to the source. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'task_file_path': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskRunRequest, self).__init__(**kwargs) - self.type = 'FileTaskRunRequest' # type: str - self.task_file_path = kwargs['task_file_path'] - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class FileTaskStep(TaskStepProperties): - """The properties of a task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: Required. The task template/definition file path relative to the source - context. - :type task_file_path: str - :param values_file_path: The task values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'base_image_dependencies': {'readonly': True}, - 'task_file_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskStep, self).__init__(**kwargs) - self.type = 'FileTask' # type: str - self.task_file_path = kwargs['task_file_path'] - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - - -class FileTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties of updating a task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: - "Docker", "FileTask", "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskStepUpdateParameters, self).__init__(**kwargs) - self.type = 'FileTask' # type: str - self.task_file_path = kwargs.get('task_file_path', None) - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - - -class ImageDescriptor(msrest.serialization.Model): - """Properties for a registry image. - - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDescriptor, self).__init__(**kwargs) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class ImageUpdateTrigger(msrest.serialization.Model): - """The image update trigger that caused a build. - - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'images': {'key': 'images', 'type': '[ImageDescriptor]'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageUpdateTrigger, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.images = kwargs.get('images', None) - - -class PlatformProperties(msrest.serialization.Model): - """The platform properties against which the run has to happen. - - All required parameters must be populated in order to send to Azure. - - :param os: Required. The operating system type required for the run. Possible values include: - "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant - """ - - _validation = { - 'os': {'required': True}, - } - - _attribute_map = { - 'os': {'key': 'os', 'type': 'str'}, - 'architecture': {'key': 'architecture', 'type': 'str'}, - 'variant': {'key': 'variant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PlatformProperties, self).__init__(**kwargs) - self.os = kwargs['os'] - self.architecture = kwargs.get('architecture', None) - self.variant = kwargs.get('variant', None) - - -class PlatformUpdateParameters(msrest.serialization.Model): - """The properties for updating the platform configuration. - - :param os: The operating system type required for the run. Possible values include: "Windows", - "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant - """ - - _attribute_map = { - 'os': {'key': 'os', 'type': 'str'}, - 'architecture': {'key': 'architecture', 'type': 'str'}, - 'variant': {'key': 'variant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PlatformUpdateParameters, self).__init__(**kwargs) - self.os = kwargs.get('os', None) - self.architecture = kwargs.get('architecture', None) - self.variant = kwargs.get('variant', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class Run(ProxyResource): - """Run resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param run_id: The unique identifier for the run. - :type run_id: str - :param status: The current status of the run. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus - :param last_updated_time: The last updated time for the run. - :type last_updated_time: ~datetime.datetime - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", - "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType - :param create_time: The time the run was scheduled. - :type create_time: ~datetime.datetime - :param start_time: The time the run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the run. This is - applicable if the run generates base image dependencies. - :type output_images: list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] - :param task: The task against which run was scheduled. - :type task: str - :param image_update_trigger: The image update trigger that caused the run. This is applicable - if the task has base image trigger configured. - :type image_update_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.ImageUpdateTrigger - :param source_trigger: The source trigger that caused the run. - :type source_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerDescriptor - :param platform: The platform properties against which the run will happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_registry_auth: The scope of the credentials that were used to login to the source - registry during this run. - :type source_registry_auth: str - :param custom_registries: The list of custom registries that were logged in during this run. - :type custom_registries: list[str] - :ivar run_error_message: The error message received from backend systems after the run is - scheduled. - :vartype run_error_message: str - :param provisioning_state: The provisioning state of a run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_09_01.models.ProvisioningState - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'run_error_message': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'run_id': {'key': 'properties.runId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, - 'run_type': {'key': 'properties.runType', 'type': 'str'}, - 'create_time': {'key': 'properties.createTime', 'type': 'iso-8601'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'properties.finishTime', 'type': 'iso-8601'}, - 'output_images': {'key': 'properties.outputImages', 'type': '[ImageDescriptor]'}, - 'task': {'key': 'properties.task', 'type': 'str'}, - 'image_update_trigger': {'key': 'properties.imageUpdateTrigger', 'type': 'ImageUpdateTrigger'}, - 'source_trigger': {'key': 'properties.sourceTrigger', 'type': 'SourceTriggerDescriptor'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'source_registry_auth': {'key': 'properties.sourceRegistryAuth', 'type': 'str'}, - 'custom_registries': {'key': 'properties.customRegistries', 'type': '[str]'}, - 'run_error_message': {'key': 'properties.runErrorMessage', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'is_archive_enabled': {'key': 'properties.isArchiveEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Run, self).__init__(**kwargs) - self.run_id = kwargs.get('run_id', None) - self.status = kwargs.get('status', None) - self.last_updated_time = kwargs.get('last_updated_time', None) - self.run_type = kwargs.get('run_type', None) - self.create_time = kwargs.get('create_time', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_images = kwargs.get('output_images', None) - self.task = kwargs.get('task', None) - self.image_update_trigger = kwargs.get('image_update_trigger', None) - self.source_trigger = kwargs.get('source_trigger', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_registry_auth = kwargs.get('source_registry_auth', None) - self.custom_registries = kwargs.get('custom_registries', None) - self.run_error_message = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', False) - - -class RunFilter(msrest.serialization.Model): - """Properties that are enabled for Odata querying on runs. - - :param run_id: The unique identifier for the run. - :type run_id: str - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", - "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType - :param status: The current status of the run. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus - :param create_time: The create time for a run. - :type create_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated - from the run. This is applicable if the run is of - build type. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param task_name: The name of the task that the run corresponds to. - :type task_name: str - """ - - _attribute_map = { - 'run_id': {'key': 'runId', 'type': 'str'}, - 'run_type': {'key': 'runType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'create_time': {'key': 'createTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'output_image_manifests': {'key': 'outputImageManifests', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'task_name': {'key': 'taskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunFilter, self).__init__(**kwargs) - self.run_id = kwargs.get('run_id', None) - self.run_type = kwargs.get('run_type', None) - self.status = kwargs.get('status', None) - self.create_time = kwargs.get('create_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_image_manifests = kwargs.get('output_image_manifests', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - self.task_name = kwargs.get('task_name', None) - - -class RunGetLogResult(msrest.serialization.Model): - """The result of get log link operation. - - :param log_link: The link to logs for a run on a azure container registry. - :type log_link: str - """ - - _attribute_map = { - 'log_link': {'key': 'logLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunGetLogResult, self).__init__(**kwargs) - self.log_link = kwargs.get('log_link', None) - - -class RunListResult(msrest.serialization.Model): - """Collection of runs. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Run] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Run]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RunUpdateParameters(msrest.serialization.Model): - """The set of run properties that can be updated. - - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - """ - - _attribute_map = { - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RunUpdateParameters, self).__init__(**kwargs) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - - -class SecretObject(msrest.serialization.Model): - """Describes the properties of a secret object value. - - :param value: The value of the secret. The format of this value will be determined - based on the type of the secret object. If the type is Opaque, the value will be - used as is without any modification. - :type value: str - :param type: The type of the secret object which determines how the value of the secret object - has to be - interpreted. Possible values include: "Opaque". - :type type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObjectType - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretObject, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.type = kwargs.get('type', None) - - -class SetValue(msrest.serialization.Model): - """The properties of a overridable value that can be passed to a task template. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the overridable value. - :type name: str - :param value: Required. The overridable value. - :type value: str - :param is_secret: Flag to indicate whether the value represents a secret or not. - :type is_secret: bool - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'is_secret': {'key': 'isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SetValue, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - self.is_secret = kwargs.get('is_secret', False) - - -class SourceProperties(msrest.serialization.Model): - """The properties of the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param source_control_type: Required. The type of source control service. Possible values - include: "Github", "VisualStudioTeamService". - :type source_control_type: str or - ~azure.mgmt.containerregistry.v2018_09_01.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source - code repository and to set up - webhooks for notifications. - :type source_control_auth_properties: ~azure.mgmt.containerregistry.v2018_09_01.models.AuthInfo - """ - - _validation = { - 'source_control_type': {'required': True}, - 'repository_url': {'required': True}, - } - - _attribute_map = { - 'source_control_type': {'key': 'sourceControlType', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'AuthInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceProperties, self).__init__(**kwargs) - self.source_control_type = kwargs['source_control_type'] - self.repository_url = kwargs['repository_url'] - self.branch = kwargs.get('branch', None) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - - -class SourceRegistryCredentials(msrest.serialization.Model): - """Describes the credential parameters for accessing the source registry. - - :param login_mode: The authentication mode which determines the source registry login scope. - The credentials for the source registry - will be generated using the given scope. These credentials will be used to login to - the source registry during the run. Possible values include: "None", "Default". - :type login_mode: str or - ~azure.mgmt.containerregistry.v2018_09_01.models.SourceRegistryLoginMode - """ - - _attribute_map = { - 'login_mode': {'key': 'loginMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceRegistryCredentials, self).__init__(**kwargs) - self.login_mode = kwargs.get('login_mode', None) - - -class SourceTrigger(msrest.serialization.Model): - """The properties of a source based trigger. - - All required parameters must be populated in order to send to Azure. - - :param source_repository: Required. The properties that describes the source(code) for the - task. - :type source_repository: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceProperties - :param source_trigger_events: Required. The source event corresponding to the trigger. - :type source_trigger_events: list[str or - ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'source_repository': {'required': True}, - 'source_trigger_events': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'source_repository': {'key': 'sourceRepository', 'type': 'SourceProperties'}, - 'source_trigger_events': {'key': 'sourceTriggerEvents', 'type': '[str]'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTrigger, self).__init__(**kwargs) - self.source_repository = kwargs['source_repository'] - self.source_trigger_events = kwargs['source_trigger_events'] - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class SourceTriggerDescriptor(msrest.serialization.Model): - """The source trigger that caused a run. - - :param id: The unique ID of the trigger. - :type id: str - :param event_type: The event type of the trigger. - :type event_type: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param pull_request_id: The unique ID that identifies pull request. - :type pull_request_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'commit_id': {'key': 'commitId', 'type': 'str'}, - 'pull_request_id': {'key': 'pullRequestId', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch_name': {'key': 'branchName', 'type': 'str'}, - 'provider_type': {'key': 'providerType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTriggerDescriptor, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.event_type = kwargs.get('event_type', None) - self.commit_id = kwargs.get('commit_id', None) - self.pull_request_id = kwargs.get('pull_request_id', None) - self.repository_url = kwargs.get('repository_url', None) - self.branch_name = kwargs.get('branch_name', None) - self.provider_type = kwargs.get('provider_type', None) - - -class SourceTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating a source based trigger. - - All required parameters must be populated in order to send to Azure. - - :param source_repository: The properties that describes the source(code) for the task. - :type source_repository: - ~azure.mgmt.containerregistry.v2018_09_01.models.SourceUpdateParameters - :param source_trigger_events: The source event corresponding to the trigger. - :type source_trigger_events: list[str or - ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'source_repository': {'key': 'sourceRepository', 'type': 'SourceUpdateParameters'}, - 'source_trigger_events': {'key': 'sourceTriggerEvents', 'type': '[str]'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTriggerUpdateParameters, self).__init__(**kwargs) - self.source_repository = kwargs.get('source_repository', None) - self.source_trigger_events = kwargs.get('source_trigger_events', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class SourceUpdateParameters(msrest.serialization.Model): - """The properties for updating the source code repository. - - :param source_control_type: The type of source control service. Possible values include: - "Github", "VisualStudioTeamService". - :type source_control_type: str or - ~azure.mgmt.containerregistry.v2018_09_01.models.SourceControlType - :param repository_url: The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source - code repository and to set up - webhooks for notifications. - :type source_control_auth_properties: - ~azure.mgmt.containerregistry.v2018_09_01.models.AuthInfoUpdateParameters - """ - - _attribute_map = { - 'source_control_type': {'key': 'sourceControlType', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'AuthInfoUpdateParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceUpdateParameters, self).__init__(**kwargs) - self.source_control_type = kwargs.get('source_control_type', None) - self.repository_url = kwargs.get('repository_url', None) - self.branch = kwargs.get('branch', None) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - - -class SourceUploadDefinition(msrest.serialization.Model): - """The properties of a response to source upload request. - - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent - queue build request. - :type relative_path: str - """ - - _attribute_map = { - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceUploadDefinition, self).__init__(**kwargs) - self.upload_url = kwargs.get('upload_url', None) - self.relative_path = kwargs.get('relative_path', None) - - -class Task(Resource): - """The task that has the ARM resource and task properties. -The task will have all information to schedule a run against it. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: The provisioning state of the task. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_09_01.models.ProvisioningState - :ivar creation_date: The creation date of task. - :vartype creation_date: ~datetime.datetime - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties of a task step. - :type step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepProperties - :param trigger: The properties that describe all triggers for the task. - :type trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerProperties - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - 'step': {'key': 'properties.step', 'type': 'TaskStepProperties'}, - 'trigger': {'key': 'properties.trigger', 'type': 'TriggerProperties'}, - 'credentials': {'key': 'properties.credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(Task, self).__init__(**kwargs) - self.provisioning_state = None - self.creation_date = None - self.status = kwargs.get('status', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.timeout = kwargs.get('timeout', 3600) - self.step = kwargs.get('step', None) - self.trigger = kwargs.get('trigger', None) - self.credentials = kwargs.get('credentials', None) - - -class TaskListResult(msrest.serialization.Model): - """The collection of tasks. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Task] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Task]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TaskRunRequest(RunRequest): - """The parameters for a task run request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the run request.Constant filled by server. - :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param task_name: Required. The name of task against which run has to be queued. - :type task_name: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True, 'readonly': True}, - 'task_name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'task_name': {'key': 'taskName', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskRunRequest, self).__init__(**kwargs) - self.type = 'TaskRunRequest' # type: str - self.task_name = kwargs['task_name'] - self.values = kwargs.get('values', None) - - -class TaskUpdateParameters(msrest.serialization.Model): - """The parameters for updating a task. - - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformUpdateParameters - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties for updating a task step. - :type step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepUpdateParameters - :param trigger: The properties for updating trigger properties. - :type trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerUpdateParameters - :param credentials: The parameters that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformUpdateParameters'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - 'step': {'key': 'properties.step', 'type': 'TaskStepUpdateParameters'}, - 'trigger': {'key': 'properties.trigger', 'type': 'TriggerUpdateParameters'}, - 'credentials': {'key': 'properties.credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.status = kwargs.get('status', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.timeout = kwargs.get('timeout', None) - self.step = kwargs.get('step', None) - self.trigger = kwargs.get('trigger', None) - self.credentials = kwargs.get('credentials', None) - - -class TriggerProperties(msrest.serialization.Model): - """The properties of a trigger. - - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: list[~azure.mgmt.containerregistry.v2018_09_01.models.SourceTrigger] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTrigger - """ - - _attribute_map = { - 'source_triggers': {'key': 'sourceTriggers', 'type': '[SourceTrigger]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'BaseImageTrigger'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerProperties, self).__init__(**kwargs) - self.source_triggers = kwargs.get('source_triggers', None) - self.base_image_trigger = kwargs.get('base_image_trigger', None) - - -class TriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating triggers. - - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: - list[~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerUpdateParameters] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: - ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerUpdateParameters - """ - - _attribute_map = { - 'source_triggers': {'key': 'sourceTriggers', 'type': '[SourceTriggerUpdateParameters]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'BaseImageTriggerUpdateParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerUpdateParameters, self).__init__(**kwargs) - self.source_triggers = kwargs.get('source_triggers', None) - self.base_image_trigger = kwargs.get('base_image_trigger', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models_py3.py index da5ecce2cef6..fc6e91370162 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/models/_models_py3.py @@ -17,8 +17,8 @@ class AgentProperties(msrest.serialization.Model): """The properties that determine the run agent configuration. - :param cpu: The CPU configuration in terms of number of cores required for the run. - :type cpu: int + :ivar cpu: The CPU configuration in terms of number of cores required for the run. + :vartype cpu: int """ _attribute_map = { @@ -31,6 +31,10 @@ def __init__( cpu: Optional[int] = None, **kwargs ): + """ + :keyword cpu: The CPU configuration in terms of number of cores required for the run. + :paramtype cpu: int + """ super(AgentProperties, self).__init__(**kwargs) self.cpu = cpu @@ -40,13 +44,13 @@ class Argument(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be + :ivar name: Required. The name of the argument. + :vartype name: str + :ivar value: Required. The value of the argument. + :vartype value: str + :ivar is_secret: Flag to indicate whether the argument represents a secret and want to be removed from build logs. - :type is_secret: bool + :vartype is_secret: bool """ _validation = { @@ -68,6 +72,15 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The name of the argument. + :paramtype name: str + :keyword value: Required. The value of the argument. + :paramtype value: str + :keyword is_secret: Flag to indicate whether the argument represents a secret and want to be + removed from build logs. + :paramtype is_secret: bool + """ super(Argument, self).__init__(**kwargs) self.name = name self.value = value @@ -79,16 +92,16 @@ class AuthInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int + :ivar token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". + :vartype token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType + :ivar token: Required. The access token used to access the source control provider. + :vartype token: str + :ivar refresh_token: The refresh token used to refresh the access token. + :vartype refresh_token: str + :ivar scope: The scope of the access token. + :vartype scope: str + :ivar expires_in: Time in seconds that the token remains valid. + :vartype expires_in: int """ _validation = { @@ -114,6 +127,18 @@ def __init__( expires_in: Optional[int] = None, **kwargs ): + """ + :keyword token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". + :paramtype token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType + :keyword token: Required. The access token used to access the source control provider. + :paramtype token: str + :keyword refresh_token: The refresh token used to refresh the access token. + :paramtype refresh_token: str + :keyword scope: The scope of the access token. + :paramtype scope: str + :keyword expires_in: Time in seconds that the token remains valid. + :paramtype expires_in: int + """ super(AuthInfo, self).__init__(**kwargs) self.token_type = token_type self.token = token @@ -125,16 +150,16 @@ def __init__( class AuthInfoUpdateParameters(msrest.serialization.Model): """The authorization properties for accessing the source code repository. - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType - :param token: The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int + :ivar token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :vartype token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType + :ivar token: The access token used to access the source control provider. + :vartype token: str + :ivar refresh_token: The refresh token used to refresh the access token. + :vartype refresh_token: str + :ivar scope: The scope of the access token. + :vartype scope: str + :ivar expires_in: Time in seconds that the token remains valid. + :vartype expires_in: int """ _attribute_map = { @@ -155,6 +180,18 @@ def __init__( expires_in: Optional[int] = None, **kwargs ): + """ + :keyword token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :paramtype token_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TokenType + :keyword token: The access token used to access the source control provider. + :paramtype token: str + :keyword refresh_token: The refresh token used to refresh the access token. + :paramtype refresh_token: str + :keyword scope: The scope of the access token. + :paramtype scope: str + :keyword expires_in: Time in seconds that the token remains valid. + :paramtype expires_in: int + """ super(AuthInfoUpdateParameters, self).__init__(**kwargs) self.token_type = token_type self.token = token @@ -166,17 +203,17 @@ def __init__( class BaseImageDependency(msrest.serialization.Model): """Properties that describe a base image dependency. - :param type: The type of the base image dependency. Possible values include: "BuildTime", + :ivar type: The type of the base image dependency. Possible values include: "BuildTime", "RunTime". - :type type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependencyType + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -197,6 +234,20 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the base image dependency. Possible values include: "BuildTime", + "RunTime". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependencyType + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(BaseImageDependency, self).__init__(**kwargs) self.type = type self.registry = registry @@ -210,14 +261,14 @@ class BaseImageTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param base_image_trigger_type: Required. The type of the auto trigger for base image - dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or + :ivar base_image_trigger_type: Required. The type of the auto trigger for base image dependency + updates. Possible values include: "All", "Runtime". + :vartype base_image_trigger_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -239,6 +290,16 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword base_image_trigger_type: Required. The type of the auto trigger for base image + dependency updates. Possible values include: "All", "Runtime". + :paramtype base_image_trigger_type: str or + ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerType + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(BaseImageTrigger, self).__init__(**kwargs) self.base_image_trigger_type = base_image_trigger_type self.status = status @@ -250,14 +311,14 @@ class BaseImageTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param base_image_trigger_type: The type of the auto trigger for base image dependency updates. + :ivar base_image_trigger_type: The type of the auto trigger for base image dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or + :vartype base_image_trigger_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -278,6 +339,16 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword base_image_trigger_type: The type of the auto trigger for base image dependency + updates. Possible values include: "All", "Runtime". + :paramtype base_image_trigger_type: str or + ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerType + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(BaseImageTriggerUpdateParameters, self).__init__(**kwargs) self.base_image_trigger_type = base_image_trigger_type self.status = status @@ -287,14 +358,14 @@ def __init__( class Credentials(msrest.serialization.Model): """The parameters that describes a set of credentials that will be used when a run is invoked. - :param source_registry: Describes the credential parameters for accessing the source registry. - :type source_registry: + :ivar source_registry: Describes the credential parameters for accessing the source registry. + :vartype source_registry: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceRegistryCredentials - :param custom_registries: Describes the credential parameters for accessing other custom + :ivar custom_registries: Describes the credential parameters for accessing other custom registries. The key for the dictionary item will be the registry login server (myregistry.azurecr.io) and the value of the item will be the registry credentials for accessing the registry. - :type custom_registries: dict[str, + :vartype custom_registries: dict[str, ~azure.mgmt.containerregistry.v2018_09_01.models.CustomRegistryCredentials] """ @@ -310,6 +381,18 @@ def __init__( custom_registries: Optional[Dict[str, "CustomRegistryCredentials"]] = None, **kwargs ): + """ + :keyword source_registry: Describes the credential parameters for accessing the source + registry. + :paramtype source_registry: + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceRegistryCredentials + :keyword custom_registries: Describes the credential parameters for accessing other custom + registries. The key + for the dictionary item will be the registry login server (myregistry.azurecr.io) and + the value of the item will be the registry credentials for accessing the registry. + :paramtype custom_registries: dict[str, + ~azure.mgmt.containerregistry.v2018_09_01.models.CustomRegistryCredentials] + """ super(Credentials, self).__init__(**kwargs) self.source_registry = source_registry self.custom_registries = custom_registries @@ -318,11 +401,11 @@ def __init__( class CustomRegistryCredentials(msrest.serialization.Model): """Describes the credentials that will be used to access a custom registry during a run. - :param user_name: The username for logging into the custom registry. - :type user_name: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject - :param password: The password for logging into the custom registry. The password is a secret + :ivar user_name: The username for logging into the custom registry. + :vartype user_name: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject + :ivar password: The password for logging into the custom registry. The password is a secret object that allows multiple ways of providing the value for it. - :type password: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject + :vartype password: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject """ _attribute_map = { @@ -337,6 +420,13 @@ def __init__( password: Optional["SecretObject"] = None, **kwargs ): + """ + :keyword user_name: The username for logging into the custom registry. + :paramtype user_name: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject + :keyword password: The password for logging into the custom registry. The password is a secret + object that allows multiple ways of providing the value for it. + :paramtype password: ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObject + """ super(CustomRegistryCredentials, self).__init__(**kwargs) self.user_name = user_name self.password = password @@ -354,9 +444,9 @@ class RunRequest(msrest.serialization.Model): :ivar type: Required. The type of the run request.Constant filled by server. :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool + :vartype is_archive_enabled: bool """ _validation = { @@ -378,6 +468,11 @@ def __init__( is_archive_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + """ super(RunRequest, self).__init__(**kwargs) self.type = None # type: Optional[str] self.is_archive_enabled = is_archive_enabled @@ -392,37 +487,36 @@ class DockerBuildRequest(RunRequest): :ivar type: Required. The type of the run request.Constant filled by server. :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :vartype is_archive_enabled: bool + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing the run. - :type arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: Required. The Docker file path relative to the source location. + :vartype docker_file_path: str + :ivar target: The name of the target build stage for the docker build. + :vartype target: str + :ivar arguments: The collection of override arguments to be used when executing the run. + :vartype arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials """ _validation = { @@ -465,6 +559,40 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: Required. The Docker file path relative to the source location. + :paramtype docker_file_path: str + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + :keyword arguments: The collection of override arguments to be used when executing the run. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + """ super(DockerBuildRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'DockerBuildRequest' # type: str self.image_names = image_names @@ -490,17 +618,17 @@ class TaskStepProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str """ _validation = { @@ -526,6 +654,13 @@ def __init__( context_access_token: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + """ super(TaskStepProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.base_image_dependencies = None @@ -540,32 +675,31 @@ class DockerBuildStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source context. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing this build + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: Required. The Docker file path relative to the source context. + :vartype docker_file_path: str + :ivar target: The name of the target build stage for the docker build. + :vartype target: str + :ivar arguments: The collection of override arguments to be used when executing this build step. - :type arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] + :vartype arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] """ _validation = { @@ -600,6 +734,28 @@ def __init__( arguments: Optional[List["Argument"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: Required. The Docker file path relative to the source context. + :paramtype docker_file_path: str + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + :keyword arguments: The collection of override arguments to be used when executing this build + step. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] + """ super(DockerBuildStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'Docker' # type: str self.image_names = image_names @@ -620,14 +776,14 @@ class TaskStepUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str """ _validation = { @@ -651,6 +807,13 @@ def __init__( context_access_token: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + """ super(TaskStepUpdateParameters, self).__init__(**kwargs) self.type = None # type: Optional[str] self.context_path = context_path @@ -664,29 +827,28 @@ class DockerBuildStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source context. - :type docker_file_path: str - :param arguments: The collection of override arguments to be used when executing this build + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: The Docker file path relative to the source context. + :vartype docker_file_path: str + :ivar arguments: The collection of override arguments to be used when executing this build step. - :type arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str + :vartype arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] + :ivar target: The name of the target build stage for the docker build. + :vartype target: str """ _validation = { @@ -718,6 +880,28 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: The Docker file path relative to the source context. + :paramtype docker_file_path: str + :keyword arguments: The collection of override arguments to be used when executing this build + step. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2018_09_01.models.Argument] + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + """ super(DockerBuildStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'Docker' # type: str self.image_names = image_names @@ -737,30 +921,30 @@ class EncodedTaskRunRequest(RunRequest): :ivar type: Required. The type of the run request.Constant filled by server. :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param encoded_task_content: Required. Base64 encoded value of the template/definition file + :vartype is_archive_enabled: bool + :ivar encoded_task_content: Required. Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials """ _validation = { @@ -797,6 +981,33 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword encoded_task_content: Required. Base64 encoded value of the template/definition file + content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + """ super(EncodedTaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'EncodedTaskRunRequest' # type: str self.encoded_task_content = encoded_task_content @@ -816,24 +1027,24 @@ class EncodedTaskStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar encoded_task_content: Required. Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] """ _validation = { @@ -862,6 +1073,20 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword encoded_task_content: Required. Base64 encoded value of the template/definition file + content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + """ super(EncodedTaskStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'EncodedTask' # type: str self.encoded_task_content = encoded_task_content @@ -876,20 +1101,20 @@ class EncodedTaskStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar encoded_task_content: Base64 encoded value of the template/definition file content. + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] """ _validation = { @@ -915,6 +1140,19 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword encoded_task_content: Base64 encoded value of the template/definition file content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + """ super(EncodedTaskStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'EncodedTask' # type: str self.encoded_task_content = encoded_task_content @@ -931,29 +1169,29 @@ class FileTaskRunRequest(RunRequest): :ivar type: Required. The type of the run request.Constant filled by server. :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param task_file_path: Required. The template/definition file path relative to the source. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :vartype is_archive_enabled: bool + :ivar task_file_path: Required. The template/definition file path relative to the source. + :vartype task_file_path: str + :ivar values_file_path: The values/parameters file path relative to the source. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials """ _validation = { @@ -990,6 +1228,32 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword task_file_path: Required. The template/definition file path relative to the source. + :paramtype task_file_path: str + :keyword values_file_path: The values/parameters file path relative to the source. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + """ super(FileTaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'FileTaskRunRequest' # type: str self.task_file_path = task_file_path @@ -1009,24 +1273,24 @@ class FileTaskStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: Required. The task template/definition file path relative to the source + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar task_file_path: Required. The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The task values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :vartype task_file_path: str + :ivar values_file_path: The task values/parameters file path relative to the source context. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] """ _validation = { @@ -1055,6 +1319,20 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword task_file_path: Required. The task template/definition file path relative to the + source context. + :paramtype task_file_path: str + :keyword values_file_path: The task values/parameters file path relative to the source context. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + """ super(FileTaskStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'FileTask' # type: str self.task_file_path = task_file_path @@ -1069,20 +1347,20 @@ class FileTaskStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: "Docker", "FileTask", "EncodedTask". :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar task_file_path: The task template/definition file path relative to the source context. + :vartype task_file_path: str + :ivar values_file_path: The values/parameters file path relative to the source context. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] """ _validation = { @@ -1108,6 +1386,19 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword task_file_path: The task template/definition file path relative to the source context. + :paramtype task_file_path: str + :keyword values_file_path: The values/parameters file path relative to the source context. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + """ super(FileTaskStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'FileTask' # type: str self.task_file_path = task_file_path @@ -1118,14 +1409,14 @@ def __init__( class ImageDescriptor(msrest.serialization.Model): """Properties for a registry image. - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -1144,6 +1435,16 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(ImageDescriptor, self).__init__(**kwargs) self.registry = registry self.repository = repository @@ -1154,12 +1455,12 @@ def __init__( class ImageUpdateTrigger(msrest.serialization.Model): """The image update trigger that caused a build. - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar timestamp: The timestamp when the image update happened. + :vartype timestamp: ~datetime.datetime + :ivar images: The list of image updates that caused the build. + :vartype images: list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] """ _attribute_map = { @@ -1176,6 +1477,14 @@ def __init__( images: Optional[List["ImageDescriptor"]] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword timestamp: The timestamp when the image update happened. + :paramtype timestamp: ~datetime.datetime + :keyword images: The list of image updates that caused the build. + :paramtype images: list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] + """ super(ImageUpdateTrigger, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -1187,13 +1496,13 @@ class PlatformProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os: Required. The operating system type required for the run. Possible values include: + :ivar os: Required. The operating system type required for the run. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant + :vartype os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS + :ivar architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :vartype architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture + :ivar variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :vartype variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant """ _validation = { @@ -1214,6 +1523,15 @@ def __init__( variant: Optional[Union[str, "Variant"]] = None, **kwargs ): + """ + :keyword os: Required. The operating system type required for the run. Possible values include: + "Windows", "Linux". + :paramtype os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS + :keyword architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :paramtype architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture + :keyword variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :paramtype variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant + """ super(PlatformProperties, self).__init__(**kwargs) self.os = os self.architecture = architecture @@ -1223,13 +1541,13 @@ def __init__( class PlatformUpdateParameters(msrest.serialization.Model): """The properties for updating the platform configuration. - :param os: The operating system type required for the run. Possible values include: "Windows", + :ivar os: The operating system type required for the run. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant + :vartype os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS + :ivar architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :vartype architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture + :ivar variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :vartype variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant """ _attribute_map = { @@ -1246,6 +1564,15 @@ def __init__( variant: Optional[Union[str, "Variant"]] = None, **kwargs ): + """ + :keyword os: The operating system type required for the run. Possible values include: + "Windows", "Linux". + :paramtype os: str or ~azure.mgmt.containerregistry.v2018_09_01.models.OS + :keyword architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :paramtype architecture: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Architecture + :keyword variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :paramtype variant: str or ~azure.mgmt.containerregistry.v2018_09_01.models.Variant + """ super(PlatformUpdateParameters, self).__init__(**kwargs) self.os = os self.architecture = architecture @@ -1281,6 +1608,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1300,11 +1629,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -1329,6 +1658,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1348,50 +1684,52 @@ class Run(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param run_id: The unique identifier for the run. - :type run_id: str - :param status: The current status of the run. Possible values include: "Queued", "Started", + :ivar run_id: The unique identifier for the run. + :vartype run_id: str + :ivar status: The current status of the run. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus - :param last_updated_time: The last updated time for the run. - :type last_updated_time: ~datetime.datetime - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus + :ivar last_updated_time: The last updated time for the run. + :vartype last_updated_time: ~datetime.datetime + :ivar run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType - :param create_time: The time the run was scheduled. - :type create_time: ~datetime.datetime - :param start_time: The time the run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the run. This is + :vartype run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType + :ivar create_time: The time the run was scheduled. + :vartype create_time: ~datetime.datetime + :ivar start_time: The time the run started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the run finished. + :vartype finish_time: ~datetime.datetime + :ivar output_images: The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - :type output_images: list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] - :param task: The task against which run was scheduled. - :type task: str - :param image_update_trigger: The image update trigger that caused the run. This is applicable - if the task has base image trigger configured. - :type image_update_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.ImageUpdateTrigger - :param source_trigger: The source trigger that caused the run. - :type source_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerDescriptor - :param platform: The platform properties against which the run will happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param source_registry_auth: The scope of the credentials that were used to login to the source + :vartype output_images: list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] + :ivar task: The task against which run was scheduled. + :vartype task: str + :ivar image_update_trigger: The image update trigger that caused the run. This is applicable if + the task has base image trigger configured. + :vartype image_update_trigger: + ~azure.mgmt.containerregistry.v2018_09_01.models.ImageUpdateTrigger + :ivar source_trigger: The source trigger that caused the run. + :vartype source_trigger: + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerDescriptor + :ivar platform: The platform properties against which the run will happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :ivar source_registry_auth: The scope of the credentials that were used to login to the source registry during this run. - :type source_registry_auth: str - :param custom_registries: The list of custom registries that were logged in during this run. - :type custom_registries: list[str] + :vartype source_registry_auth: str + :ivar custom_registries: The list of custom registries that were logged in during this run. + :vartype custom_registries: list[str] :ivar run_error_message: The error message received from backend systems after the run is scheduled. :vartype run_error_message: str - :param provisioning_state: The provisioning state of a run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or + :ivar provisioning_state: The provisioning state of a run. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2018_09_01.models.ProvisioningState - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool """ _validation = { @@ -1447,6 +1785,53 @@ def __init__( is_archive_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword run_id: The unique identifier for the run. + :paramtype run_id: str + :keyword status: The current status of the run. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus + :keyword last_updated_time: The last updated time for the run. + :paramtype last_updated_time: ~datetime.datetime + :keyword run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + "AutoBuild", "AutoRun". + :paramtype run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType + :keyword create_time: The time the run was scheduled. + :paramtype create_time: ~datetime.datetime + :keyword start_time: The time the run started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the run finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_images: The list of all images that were generated from the run. This is + applicable if the run generates base image dependencies. + :paramtype output_images: + list[~azure.mgmt.containerregistry.v2018_09_01.models.ImageDescriptor] + :keyword task: The task against which run was scheduled. + :paramtype task: str + :keyword image_update_trigger: The image update trigger that caused the run. This is applicable + if the task has base image trigger configured. + :paramtype image_update_trigger: + ~azure.mgmt.containerregistry.v2018_09_01.models.ImageUpdateTrigger + :keyword source_trigger: The source trigger that caused the run. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerDescriptor + :keyword platform: The platform properties against which the run will happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :keyword source_registry_auth: The scope of the credentials that were used to login to the + source registry during this run. + :paramtype source_registry_auth: str + :keyword custom_registries: The list of custom registries that were logged in during this run. + :paramtype custom_registries: list[str] + :keyword provisioning_state: The provisioning state of a run. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.containerregistry.v2018_09_01.models.ProvisioningState + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + """ super(Run, self).__init__(**kwargs) self.run_id = run_id self.status = status @@ -1471,26 +1856,26 @@ def __init__( class RunFilter(msrest.serialization.Model): """Properties that are enabled for Odata querying on runs. - :param run_id: The unique identifier for the run. - :type run_id: str - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + :ivar run_id: The unique identifier for the run. + :vartype run_id: str + :ivar run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType - :param status: The current status of the run. Possible values include: "Queued", "Started", + :vartype run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType + :ivar status: The current status of the run. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus - :param create_time: The create time for a run. - :type create_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus + :ivar create_time: The create time for a run. + :vartype create_time: ~datetime.datetime + :ivar finish_time: The time the run finished. + :vartype finish_time: ~datetime.datetime + :ivar output_image_manifests: The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of build type. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param task_name: The name of the task that the run corresponds to. - :type task_name: str + :vartype output_image_manifests: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool + :ivar task_name: The name of the task that the run corresponds to. + :vartype task_name: str """ _attribute_map = { @@ -1517,6 +1902,28 @@ def __init__( task_name: Optional[str] = None, **kwargs ): + """ + :keyword run_id: The unique identifier for the run. + :paramtype run_id: str + :keyword run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + "AutoBuild", "AutoRun". + :paramtype run_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunType + :keyword status: The current status of the run. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.RunStatus + :keyword create_time: The create time for a run. + :paramtype create_time: ~datetime.datetime + :keyword finish_time: The time the run finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_image_manifests: The list of comma-separated image manifests that were + generated from the run. This is applicable if the run is of + build type. + :paramtype output_image_manifests: str + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + :keyword task_name: The name of the task that the run corresponds to. + :paramtype task_name: str + """ super(RunFilter, self).__init__(**kwargs) self.run_id = run_id self.run_type = run_type @@ -1531,8 +1938,8 @@ def __init__( class RunGetLogResult(msrest.serialization.Model): """The result of get log link operation. - :param log_link: The link to logs for a run on a azure container registry. - :type log_link: str + :ivar log_link: The link to logs for a run on a azure container registry. + :vartype log_link: str """ _attribute_map = { @@ -1545,6 +1952,10 @@ def __init__( log_link: Optional[str] = None, **kwargs ): + """ + :keyword log_link: The link to logs for a run on a azure container registry. + :paramtype log_link: str + """ super(RunGetLogResult, self).__init__(**kwargs) self.log_link = log_link @@ -1552,10 +1963,10 @@ def __init__( class RunListResult(msrest.serialization.Model): """Collection of runs. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Run] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Run] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -1570,6 +1981,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Run] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(RunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1578,8 +1995,8 @@ def __init__( class RunUpdateParameters(msrest.serialization.Model): """The set of run properties that can be updated. - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool """ _attribute_map = { @@ -1592,6 +2009,10 @@ def __init__( is_archive_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + """ super(RunUpdateParameters, self).__init__(**kwargs) self.is_archive_enabled = is_archive_enabled @@ -1599,14 +2020,14 @@ def __init__( class SecretObject(msrest.serialization.Model): """Describes the properties of a secret object value. - :param value: The value of the secret. The format of this value will be determined + :ivar value: The value of the secret. The format of this value will be determined based on the type of the secret object. If the type is Opaque, the value will be used as is without any modification. - :type value: str - :param type: The type of the secret object which determines how the value of the secret object + :vartype value: str + :ivar type: The type of the secret object which determines how the value of the secret object has to be interpreted. Possible values include: "Opaque". - :type type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObjectType + :vartype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObjectType """ _attribute_map = { @@ -1621,6 +2042,16 @@ def __init__( type: Optional[Union[str, "SecretObjectType"]] = None, **kwargs ): + """ + :keyword value: The value of the secret. The format of this value will be determined + based on the type of the secret object. If the type is Opaque, the value will be + used as is without any modification. + :paramtype value: str + :keyword type: The type of the secret object which determines how the value of the secret + object has to be + interpreted. Possible values include: "Opaque". + :paramtype type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.SecretObjectType + """ super(SecretObject, self).__init__(**kwargs) self.value = value self.type = type @@ -1631,12 +2062,12 @@ class SetValue(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the overridable value. - :type name: str - :param value: Required. The overridable value. - :type value: str - :param is_secret: Flag to indicate whether the value represents a secret or not. - :type is_secret: bool + :ivar name: Required. The name of the overridable value. + :vartype name: str + :ivar value: Required. The overridable value. + :vartype value: str + :ivar is_secret: Flag to indicate whether the value represents a secret or not. + :vartype is_secret: bool """ _validation = { @@ -1658,6 +2089,14 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The name of the overridable value. + :paramtype name: str + :keyword value: Required. The overridable value. + :paramtype value: str + :keyword is_secret: Flag to indicate whether the value represents a secret or not. + :paramtype is_secret: bool + """ super(SetValue, self).__init__(**kwargs) self.name = name self.value = value @@ -1669,18 +2108,19 @@ class SourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_control_type: Required. The type of source control service. Possible values + :ivar source_control_type: Required. The type of source control service. Possible values include: "Github", "VisualStudioTeamService". - :type source_control_type: str or + :vartype source_control_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source + :ivar repository_url: Required. The full URL to the source code repository. + :vartype repository_url: str + :ivar branch: The branch name of the source code. + :vartype branch: str + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository and to set up webhooks for notifications. - :type source_control_auth_properties: ~azure.mgmt.containerregistry.v2018_09_01.models.AuthInfo + :vartype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2018_09_01.models.AuthInfo """ _validation = { @@ -1704,6 +2144,21 @@ def __init__( source_control_auth_properties: Optional["AuthInfo"] = None, **kwargs ): + """ + :keyword source_control_type: Required. The type of source control service. Possible values + include: "Github", "VisualStudioTeamService". + :paramtype source_control_type: str or + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceControlType + :keyword repository_url: Required. The full URL to the source code repository. + :paramtype repository_url: str + :keyword branch: The branch name of the source code. + :paramtype branch: str + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository and to set up + webhooks for notifications. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2018_09_01.models.AuthInfo + """ super(SourceProperties, self).__init__(**kwargs) self.source_control_type = source_control_type self.repository_url = repository_url @@ -1714,11 +2169,11 @@ def __init__( class SourceRegistryCredentials(msrest.serialization.Model): """Describes the credential parameters for accessing the source registry. - :param login_mode: The authentication mode which determines the source registry login scope. - The credentials for the source registry + :ivar login_mode: The authentication mode which determines the source registry login scope. The + credentials for the source registry will be generated using the given scope. These credentials will be used to login to the source registry during the run. Possible values include: "None", "Default". - :type login_mode: str or + :vartype login_mode: str or ~azure.mgmt.containerregistry.v2018_09_01.models.SourceRegistryLoginMode """ @@ -1732,6 +2187,14 @@ def __init__( login_mode: Optional[Union[str, "SourceRegistryLoginMode"]] = None, **kwargs ): + """ + :keyword login_mode: The authentication mode which determines the source registry login scope. + The credentials for the source registry + will be generated using the given scope. These credentials will be used to login to + the source registry during the run. Possible values include: "None", "Default". + :paramtype login_mode: str or + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceRegistryLoginMode + """ super(SourceRegistryCredentials, self).__init__(**kwargs) self.login_mode = login_mode @@ -1741,16 +2204,15 @@ class SourceTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_repository: Required. The properties that describes the source(code) for the - task. - :type source_repository: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceProperties - :param source_trigger_events: Required. The source event corresponding to the trigger. - :type source_trigger_events: list[str or + :ivar source_repository: Required. The properties that describes the source(code) for the task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceProperties + :ivar source_trigger_events: Required. The source event corresponding to the trigger. + :vartype source_trigger_events: list[str or ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -1775,6 +2237,18 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword source_repository: Required. The properties that describes the source(code) for the + task. + :paramtype source_repository: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceProperties + :keyword source_trigger_events: Required. The source event corresponding to the trigger. + :paramtype source_trigger_events: list[str or + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerEvent] + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(SourceTrigger, self).__init__(**kwargs) self.source_repository = source_repository self.source_trigger_events = source_trigger_events @@ -1785,20 +2259,20 @@ def __init__( class SourceTriggerDescriptor(msrest.serialization.Model): """The source trigger that caused a run. - :param id: The unique ID of the trigger. - :type id: str - :param event_type: The event type of the trigger. - :type event_type: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param pull_request_id: The unique ID that identifies pull request. - :type pull_request_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar event_type: The event type of the trigger. + :vartype event_type: str + :ivar commit_id: The unique ID that identifies a commit. + :vartype commit_id: str + :ivar pull_request_id: The unique ID that identifies pull request. + :vartype pull_request_id: str + :ivar repository_url: The repository URL. + :vartype repository_url: str + :ivar branch_name: The branch name in the repository. + :vartype branch_name: str + :ivar provider_type: The source control provider type. + :vartype provider_type: str """ _attribute_map = { @@ -1823,6 +2297,22 @@ def __init__( provider_type: Optional[str] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword event_type: The event type of the trigger. + :paramtype event_type: str + :keyword commit_id: The unique ID that identifies a commit. + :paramtype commit_id: str + :keyword pull_request_id: The unique ID that identifies pull request. + :paramtype pull_request_id: str + :keyword repository_url: The repository URL. + :paramtype repository_url: str + :keyword branch_name: The branch name in the repository. + :paramtype branch_name: str + :keyword provider_type: The source control provider type. + :paramtype provider_type: str + """ super(SourceTriggerDescriptor, self).__init__(**kwargs) self.id = id self.event_type = event_type @@ -1838,16 +2328,16 @@ class SourceTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_repository: The properties that describes the source(code) for the task. - :type source_repository: + :ivar source_repository: The properties that describes the source(code) for the task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2018_09_01.models.SourceUpdateParameters - :param source_trigger_events: The source event corresponding to the trigger. - :type source_trigger_events: list[str or + :ivar source_trigger_events: The source event corresponding to the trigger. + :vartype source_trigger_events: list[str or ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -1870,6 +2360,18 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword source_repository: The properties that describes the source(code) for the task. + :paramtype source_repository: + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceUpdateParameters + :keyword source_trigger_events: The source event corresponding to the trigger. + :paramtype source_trigger_events: list[str or + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerEvent] + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(SourceTriggerUpdateParameters, self).__init__(**kwargs) self.source_repository = source_repository self.source_trigger_events = source_trigger_events @@ -1880,18 +2382,18 @@ def __init__( class SourceUpdateParameters(msrest.serialization.Model): """The properties for updating the source code repository. - :param source_control_type: The type of source control service. Possible values include: + :ivar source_control_type: The type of source control service. Possible values include: "Github", "VisualStudioTeamService". - :type source_control_type: str or + :vartype source_control_type: str or ~azure.mgmt.containerregistry.v2018_09_01.models.SourceControlType - :param repository_url: The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source + :ivar repository_url: The full URL to the source code repository. + :vartype repository_url: str + :ivar branch: The branch name of the source code. + :vartype branch: str + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository and to set up webhooks for notifications. - :type source_control_auth_properties: + :vartype source_control_auth_properties: ~azure.mgmt.containerregistry.v2018_09_01.models.AuthInfoUpdateParameters """ @@ -1911,6 +2413,21 @@ def __init__( source_control_auth_properties: Optional["AuthInfoUpdateParameters"] = None, **kwargs ): + """ + :keyword source_control_type: The type of source control service. Possible values include: + "Github", "VisualStudioTeamService". + :paramtype source_control_type: str or + ~azure.mgmt.containerregistry.v2018_09_01.models.SourceControlType + :keyword repository_url: The full URL to the source code repository. + :paramtype repository_url: str + :keyword branch: The branch name of the source code. + :paramtype branch: str + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository and to set up + webhooks for notifications. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2018_09_01.models.AuthInfoUpdateParameters + """ super(SourceUpdateParameters, self).__init__(**kwargs) self.source_control_type = source_control_type self.repository_url = repository_url @@ -1921,11 +2438,11 @@ def __init__( class SourceUploadDefinition(msrest.serialization.Model): """The properties of a response to source upload request. - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent + :ivar upload_url: The URL where the client can upload the source. + :vartype upload_url: str + :ivar relative_path: The relative path to the source. This is used to submit the subsequent queue build request. - :type relative_path: str + :vartype relative_path: str """ _attribute_map = { @@ -1940,6 +2457,13 @@ def __init__( relative_path: Optional[str] = None, **kwargs ): + """ + :keyword upload_url: The URL where the client can upload the source. + :paramtype upload_url: str + :keyword relative_path: The relative path to the source. This is used to submit the subsequent + queue build request. + :paramtype relative_path: str + """ super(SourceUploadDefinition, self).__init__(**kwargs) self.upload_url = upload_url self.relative_path = relative_path @@ -1959,32 +2483,32 @@ class Task(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar provisioning_state: The provisioning state of the task. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2018_09_01.models.ProvisioningState :ivar creation_date: The creation date of task. :vartype creation_date: ~datetime.datetime - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties of a task step. - :type step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepProperties - :param trigger: The properties that describe all triggers for the task. - :type trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerProperties - :param credentials: The properties that describes a set of credentials that will be used when + :ivar status: The current status of task. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus + :ivar platform: The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar step: The properties of a task step. + :vartype step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepProperties + :ivar trigger: The properties that describe all triggers for the task. + :vartype trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerProperties + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials """ _validation = { @@ -2028,6 +2552,29 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The current status of task. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus + :keyword platform: The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword step: The properties of a task step. + :paramtype step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepProperties + :keyword trigger: The properties that describe all triggers for the task. + :paramtype trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerProperties + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + """ super(Task, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.creation_date = None @@ -2043,10 +2590,10 @@ def __init__( class TaskListResult(msrest.serialization.Model): """The collection of tasks. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Task] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Task] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -2061,6 +2608,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2018_09_01.models.Task] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(TaskListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2075,13 +2628,13 @@ class TaskRunRequest(RunRequest): :ivar type: Required. The type of the run request.Constant filled by server. :vartype type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param task_name: Required. The name of task against which run has to be queued. - :type task_name: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + :vartype is_archive_enabled: bool + :ivar task_name: Required. The name of task against which run has to be queued. + :vartype task_name: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] """ _validation = { @@ -2104,6 +2657,15 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword task_name: Required. The name of task against which run has to be queued. + :paramtype task_name: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2018_09_01.models.SetValue] + """ super(TaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'TaskRunRequest' # type: str self.task_name = task_name @@ -2113,23 +2675,23 @@ def __init__( class TaskUpdateParameters(msrest.serialization.Model): """The parameters for updating a task. - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformUpdateParameters - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties for updating a task step. - :type step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepUpdateParameters - :param trigger: The properties for updating trigger properties. - :type trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerUpdateParameters - :param credentials: The parameters that describes a set of credentials that will be used when + :ivar tags: A set of tags. The ARM resource tags. + :vartype tags: dict[str, str] + :ivar status: The current status of task. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus + :ivar platform: The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformUpdateParameters + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar step: The properties for updating a task step. + :vartype step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepUpdateParameters + :ivar trigger: The properties for updating trigger properties. + :vartype trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerUpdateParameters + :ivar credentials: The parameters that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials """ _attribute_map = { @@ -2156,6 +2718,26 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The ARM resource tags. + :paramtype tags: dict[str, str] + :keyword status: The current status of task. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStatus + :keyword platform: The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2018_09_01.models.PlatformUpdateParameters + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2018_09_01.models.AgentProperties + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword step: The properties for updating a task step. + :paramtype step: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskStepUpdateParameters + :keyword trigger: The properties for updating trigger properties. + :paramtype trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.TriggerUpdateParameters + :keyword credentials: The parameters that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2018_09_01.models.Credentials + """ super(TaskUpdateParameters, self).__init__(**kwargs) self.tags = tags self.status = status @@ -2170,10 +2752,10 @@ def __init__( class TriggerProperties(msrest.serialization.Model): """The properties of a trigger. - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: list[~azure.mgmt.containerregistry.v2018_09_01.models.SourceTrigger] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTrigger + :ivar source_triggers: The collection of triggers based on source code repository. + :vartype source_triggers: list[~azure.mgmt.containerregistry.v2018_09_01.models.SourceTrigger] + :ivar base_image_trigger: The trigger based on base image dependencies. + :vartype base_image_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTrigger """ _attribute_map = { @@ -2188,6 +2770,14 @@ def __init__( base_image_trigger: Optional["BaseImageTrigger"] = None, **kwargs ): + """ + :keyword source_triggers: The collection of triggers based on source code repository. + :paramtype source_triggers: + list[~azure.mgmt.containerregistry.v2018_09_01.models.SourceTrigger] + :keyword base_image_trigger: The trigger based on base image dependencies. + :paramtype base_image_trigger: + ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTrigger + """ super(TriggerProperties, self).__init__(**kwargs) self.source_triggers = source_triggers self.base_image_trigger = base_image_trigger @@ -2196,11 +2786,11 @@ def __init__( class TriggerUpdateParameters(msrest.serialization.Model): """The properties for updating triggers. - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: + :ivar source_triggers: The collection of triggers based on source code repository. + :vartype source_triggers: list[~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerUpdateParameters] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: + :ivar base_image_trigger: The trigger based on base image dependencies. + :vartype base_image_trigger: ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerUpdateParameters """ @@ -2216,6 +2806,14 @@ def __init__( base_image_trigger: Optional["BaseImageTriggerUpdateParameters"] = None, **kwargs ): + """ + :keyword source_triggers: The collection of triggers based on source code repository. + :paramtype source_triggers: + list[~azure.mgmt.containerregistry.v2018_09_01.models.SourceTriggerUpdateParameters] + :keyword base_image_trigger: The trigger based on base image dependencies. + :paramtype base_image_trigger: + ~azure.mgmt.containerregistry.v2018_09_01.models.BaseImageTriggerUpdateParameters + """ super(TriggerUpdateParameters, self).__init__(**kwargs) self.source_triggers = source_triggers self.base_image_trigger = base_image_trigger diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_registries_operations.py index 5e19ee4f6b03..28fe1e5e554d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_registries_operations.py @@ -5,24 +5,106 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_schedule_run_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_build_source_upload_url_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -48,43 +130,32 @@ def __init__(self, client, config, serializer, deserializer): def _schedule_run_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_request, # type: "_models.RunRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Run"] + resource_group_name: str, + registry_name: str, + run_request: "_models.RunRequest", + **kwargs: Any + ) -> Optional["_models.Run"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Run"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._schedule_run_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_request, 'RunRequest') + + request = build_schedule_run_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._schedule_run_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_request, 'RunRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,16 +171,18 @@ def _schedule_run_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _schedule_run_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + + @distributed_trace def begin_schedule_run( self, - resource_group_name, # type: str - registry_name, # type: str - run_request, # type: "_models.RunRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Run"] + resource_group_name: str, + registry_name: str, + run_request: "_models.RunRequest", + **kwargs: Any + ) -> LROPoller["_models.Run"]: """Schedules a new run based on the request parameters and add it to the run queue. :param resource_group_name: The name of the resource group to which the container registry @@ -121,15 +194,18 @@ def begin_schedule_run( :type run_request: ~azure.mgmt.containerregistry.v2018_09_01.models.RunRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Run or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +217,21 @@ def begin_schedule_run( resource_group_name=resource_group_name, registry_name=registry_name, run_request=run_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,15 +243,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_schedule_run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + @distributed_trace def get_build_source_upload_url( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceUploadDefinition" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.SourceUploadDefinition": """Get the upload location for the user to be able to upload the source. :param resource_group_name: The name of the resource group to which the container registry @@ -199,27 +270,17 @@ def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,4 +294,6 @@ def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_runs_operations.py index ba930702b099..af09fdd51b6b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_runs_operations.py @@ -5,25 +5,221 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_log_sas_url_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_cancel_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class RunsOperations(object): """RunsOperations operations. @@ -47,15 +243,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.RunListResult"]: """Gets all the runs for a registry. :param resource_group_name: The name of the resource group to which the container registry @@ -72,7 +268,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.RunListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.RunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunListResult"] @@ -80,40 +277,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunListResult', pipeline_response) + deserialized = self._deserialize("RunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,19 +325,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Run" + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> "_models.Run": """Gets the detailed information for a given run. :param resource_group_name: The name of the resource group to which the container registry @@ -163,28 +358,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -198,49 +383,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - run_update_parameters, # type: "_models.RunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Run" + resource_group_name: str, + registry_name: str, + run_id: str, + run_update_parameters: "_models.RunUpdateParameters", + **kwargs: Any + ) -> "_models.Run": cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_update_parameters, 'RunUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_update_parameters, 'RunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -258,17 +434,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - run_update_parameters, # type: "_models.RunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Run"] + resource_group_name: str, + registry_name: str, + run_id: str, + run_update_parameters: "_models.RunUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Run"]: """Patch the run properties. :param resource_group_name: The name of the resource group to which the container registry @@ -279,18 +457,22 @@ def begin_update( :param run_id: The run ID. :type run_id: str :param run_update_parameters: The run update properties. - :type run_update_parameters: ~azure.mgmt.containerregistry.v2018_09_01.models.RunUpdateParameters + :type run_update_parameters: + ~azure.mgmt.containerregistry.v2018_09_01.models.RunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Run or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -303,28 +485,21 @@ def begin_update( registry_name=registry_name, run_id=run_id, run_update_parameters=run_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -336,16 +511,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + @distributed_trace def get_log_sas_url( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunGetLogResult" + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> "_models.RunGetLogResult": """Gets a link to download the run logs. :param resource_group_name: The name of the resource group to which the container registry @@ -365,28 +541,18 @@ def get_log_sas_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_sas_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_sas_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get_log_sas_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -400,41 +566,34 @@ def get_log_sas_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_sas_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl'} # type: ignore + def _cancel_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -447,14 +606,15 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancel an existing run. :param resource_group_name: The name of the resource group to which the container registry @@ -466,15 +626,17 @@ def begin_cancel( :type run_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -489,22 +651,14 @@ def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -516,4 +670,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_tasks_operations.py index 0c55151765b8..8916fd892034 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/operations/_tasks_operations.py @@ -5,25 +5,260 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_details_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TasksOperations(object): """TasksOperations operations. @@ -47,13 +282,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TaskListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TaskListResult"]: """Lists all the tasks for a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -63,7 +298,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.TaskListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_09_01.models.TaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskListResult"] @@ -71,36 +307,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TaskListResult', pipeline_response) + deserialized = self._deserialize("TaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +351,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> "_models.Task": """Get the properties of a specified task. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +384,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +409,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_create_parameters, # type: "_models.Task" - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + task_create_parameters: "_models.Task", + **kwargs: Any + ) -> "_models.Task": cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(task_create_parameters, 'Task') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_create_parameters, 'Task') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +460,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_create_parameters, # type: "_models.Task" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Task"] + resource_group_name: str, + registry_name: str, + task_name: str, + task_create_parameters: "_models.Task", + **kwargs: Any + ) -> LROPoller["_models.Task"]: """Creates a task for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -269,15 +486,18 @@ def begin_create( :type task_create_parameters: ~azure.mgmt.containerregistry.v2018_09_01.models.Task :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Task or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +510,21 @@ def begin_create( registry_name=registry_name, task_name=task_name, task_create_parameters=task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +536,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +575,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified task. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +595,17 @@ def begin_delete( :type task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +620,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,49 +639,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_update_parameters, # type: "_models.TaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + task_update_parameters: "_models.TaskUpdateParameters", + **kwargs: Any + ) -> "_models.Task": cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,17 +689,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_update_parameters, # type: "_models.TaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Task"] + resource_group_name: str, + registry_name: str, + task_name: str, + task_update_parameters: "_models.TaskUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Task"]: """Updates a task with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -520,18 +712,22 @@ def begin_update( :param task_name: The name of the container registry task. :type task_name: str :param task_update_parameters: The parameters for updating a task. - :type task_update_parameters: ~azure.mgmt.containerregistry.v2018_09_01.models.TaskUpdateParameters + :type task_update_parameters: + ~azure.mgmt.containerregistry.v2018_09_01.models.TaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Task or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_09_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -544,28 +740,21 @@ def begin_update( registry_name=registry_name, task_name=task_name, task_update_parameters=task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -577,16 +766,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + @distributed_trace def get_details( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> "_models.Task": """Returns a task with extended information that includes all secrets. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +796,18 @@ def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,4 +821,6 @@ def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_configuration.py index 2263554732f0..272056b4053d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_container_registry_management_client.py index aa02d81df1eb..4446d7eda882 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_container_registry_management_client.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import RegistriesOperations, RunsOperations, TasksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import RunsOperations -from .operations import TasksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations @@ -38,52 +34,56 @@ class ContainerRegistryManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.runs = RunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_metadata.json index b77c148d5572..27bfadc11b22 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "registries": "RegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_configuration.py index 081ed8db292b..c713f7e085ed 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_container_registry_management_client.py index 1d5883618771..e428d0a27040 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_container_registry_management_client.py @@ -6,28 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import RegistriesOperations, RunsOperations, TasksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import RunsOperations -from .operations import TasksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_04_01.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_04_01.aio.operations.RegistriesOperations :ivar runs: RunsOperations operations :vartype runs: azure.mgmt.containerregistry.v2019_04_01.aio.operations.RunsOperations :ivar tasks: TasksOperations operations @@ -36,50 +35,56 @@ class ContainerRegistryManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.runs = RunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_registries_operations.py index b9320fef0462..20fc1777960a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_registries_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_get_build_source_upload_url_request, build_schedule_run_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,32 +58,22 @@ async def _schedule_run_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._schedule_run_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_request, 'RunRequest') + + request = build_schedule_run_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._schedule_run_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_request, 'RunRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,8 +89,11 @@ async def _schedule_run_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _schedule_run_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + + @distributed_trace_async async def begin_schedule_run( self, resource_group_name: str, @@ -115,15 +112,19 @@ async def begin_schedule_run( :type run_request: ~azure.mgmt.containerregistry.v2019_04_01.models.RunRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,27 +136,21 @@ async def begin_schedule_run( resource_group_name=resource_group_name, registry_name=registry_name, run_request=run_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,8 +162,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_schedule_run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + @distributed_trace_async async def get_build_source_upload_url( self, resource_group_name: str, @@ -192,27 +189,17 @@ async def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,4 +213,6 @@ async def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_runs_operations.py index a50452354c7f..f5abbac50ea3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runs_operations import build_cancel_request_initial, build_get_log_sas_url_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,7 +73,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.RunListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.RunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunListResult"] @@ -75,40 +82,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunListResult', pipeline_response) + deserialized = self._deserialize("RunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,11 +130,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -157,28 +163,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,8 +188,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -207,33 +205,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_update_parameters, 'RunUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_update_parameters, 'RunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,8 +239,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -271,18 +262,23 @@ async def begin_update( :param run_id: The run ID. :type run_id: str :param run_update_parameters: The run update properties. - :type run_update_parameters: ~azure.mgmt.containerregistry.v2019_04_01.models.RunUpdateParameters + :type run_update_parameters: + ~azure.mgmt.containerregistry.v2019_04_01.models.RunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +291,21 @@ async def begin_update( registry_name=registry_name, run_id=run_id, run_update_parameters=run_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -328,8 +317,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + @distributed_trace_async async def get_log_sas_url( self, resource_group_name: str, @@ -356,28 +347,18 @@ async def get_log_sas_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_log_sas_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_sas_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get_log_sas_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,8 +372,10 @@ async def get_log_sas_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_sas_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl'} # type: ignore + async def _cancel_initial( self, resource_group_name: str, @@ -405,26 +388,18 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -437,6 +412,8 @@ async def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -455,15 +432,17 @@ async def begin_cancel( :type run_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -478,22 +457,14 @@ async def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -505,4 +476,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_tasks_operations.py index 8071e523d999..5837872f7da6 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/aio/operations/_tasks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tasks_operations import build_create_request_initial, build_delete_request_initial, build_get_details_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.TaskListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.TaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskListResult"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TaskListResult', pipeline_response) + deserialized = self._deserialize("TaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +150,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +175,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +192,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(task_create_parameters, 'Task') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_create_parameters, 'Task') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +226,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,15 +252,19 @@ async def begin_create( :type task_create_parameters: ~azure.mgmt.containerregistry.v2019_04_01.models.Task :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +277,21 @@ async def begin_create( registry_name=registry_name, task_name=task_name, task_create_parameters=task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore async def _delete_initial( @@ -329,26 +318,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +342,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +362,17 @@ async def begin_delete( :type task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +406,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore async def _update_initial( @@ -444,33 +422,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,8 +456,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -508,18 +479,23 @@ async def begin_update( :param task_name: The name of the container registry task. :type task_name: str :param task_update_parameters: The parameters for updating a task. - :type task_update_parameters: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskUpdateParameters + :type task_update_parameters: + ~azure.mgmt.containerregistry.v2019_04_01.models.TaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -532,28 +508,21 @@ async def begin_update( registry_name=registry_name, task_name=task_name, task_update_parameters=task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -565,8 +534,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + @distributed_trace_async async def get_details( self, resource_group_name: str, @@ -593,28 +564,18 @@ async def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,4 +589,6 @@ async def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/__init__.py index 2807b77b78b8..4f5b31cf9f37 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/__init__.py @@ -6,112 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AgentProperties - from ._models_py3 import Argument - from ._models_py3 import AuthInfo - from ._models_py3 import AuthInfoUpdateParameters - from ._models_py3 import BaseImageDependency - from ._models_py3 import BaseImageTrigger - from ._models_py3 import BaseImageTriggerUpdateParameters - from ._models_py3 import Credentials - from ._models_py3 import CustomRegistryCredentials - from ._models_py3 import DockerBuildRequest - from ._models_py3 import DockerBuildStep - from ._models_py3 import DockerBuildStepUpdateParameters - from ._models_py3 import EncodedTaskRunRequest - from ._models_py3 import EncodedTaskStep - from ._models_py3 import EncodedTaskStepUpdateParameters - from ._models_py3 import FileTaskRunRequest - from ._models_py3 import FileTaskStep - from ._models_py3 import FileTaskStepUpdateParameters - from ._models_py3 import IdentityProperties - from ._models_py3 import ImageDescriptor - from ._models_py3 import ImageUpdateTrigger - from ._models_py3 import PlatformProperties - from ._models_py3 import PlatformUpdateParameters - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import Run - from ._models_py3 import RunFilter - from ._models_py3 import RunGetLogResult - from ._models_py3 import RunListResult - from ._models_py3 import RunRequest - from ._models_py3 import RunUpdateParameters - from ._models_py3 import SecretObject - from ._models_py3 import SetValue - from ._models_py3 import SourceProperties - from ._models_py3 import SourceRegistryCredentials - from ._models_py3 import SourceTrigger - from ._models_py3 import SourceTriggerDescriptor - from ._models_py3 import SourceTriggerUpdateParameters - from ._models_py3 import SourceUpdateParameters - from ._models_py3 import SourceUploadDefinition - from ._models_py3 import Task - from ._models_py3 import TaskListResult - from ._models_py3 import TaskRunRequest - from ._models_py3 import TaskStepProperties - from ._models_py3 import TaskStepUpdateParameters - from ._models_py3 import TaskUpdateParameters - from ._models_py3 import TimerTrigger - from ._models_py3 import TimerTriggerDescriptor - from ._models_py3 import TimerTriggerUpdateParameters - from ._models_py3 import TriggerProperties - from ._models_py3 import TriggerUpdateParameters - from ._models_py3 import UserIdentityProperties -except (SyntaxError, ImportError): - from ._models import AgentProperties # type: ignore - from ._models import Argument # type: ignore - from ._models import AuthInfo # type: ignore - from ._models import AuthInfoUpdateParameters # type: ignore - from ._models import BaseImageDependency # type: ignore - from ._models import BaseImageTrigger # type: ignore - from ._models import BaseImageTriggerUpdateParameters # type: ignore - from ._models import Credentials # type: ignore - from ._models import CustomRegistryCredentials # type: ignore - from ._models import DockerBuildRequest # type: ignore - from ._models import DockerBuildStep # type: ignore - from ._models import DockerBuildStepUpdateParameters # type: ignore - from ._models import EncodedTaskRunRequest # type: ignore - from ._models import EncodedTaskStep # type: ignore - from ._models import EncodedTaskStepUpdateParameters # type: ignore - from ._models import FileTaskRunRequest # type: ignore - from ._models import FileTaskStep # type: ignore - from ._models import FileTaskStepUpdateParameters # type: ignore - from ._models import IdentityProperties # type: ignore - from ._models import ImageDescriptor # type: ignore - from ._models import ImageUpdateTrigger # type: ignore - from ._models import PlatformProperties # type: ignore - from ._models import PlatformUpdateParameters # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import Run # type: ignore - from ._models import RunFilter # type: ignore - from ._models import RunGetLogResult # type: ignore - from ._models import RunListResult # type: ignore - from ._models import RunRequest # type: ignore - from ._models import RunUpdateParameters # type: ignore - from ._models import SecretObject # type: ignore - from ._models import SetValue # type: ignore - from ._models import SourceProperties # type: ignore - from ._models import SourceRegistryCredentials # type: ignore - from ._models import SourceTrigger # type: ignore - from ._models import SourceTriggerDescriptor # type: ignore - from ._models import SourceTriggerUpdateParameters # type: ignore - from ._models import SourceUpdateParameters # type: ignore - from ._models import SourceUploadDefinition # type: ignore - from ._models import Task # type: ignore - from ._models import TaskListResult # type: ignore - from ._models import TaskRunRequest # type: ignore - from ._models import TaskStepProperties # type: ignore - from ._models import TaskStepUpdateParameters # type: ignore - from ._models import TaskUpdateParameters # type: ignore - from ._models import TimerTrigger # type: ignore - from ._models import TimerTriggerDescriptor # type: ignore - from ._models import TimerTriggerUpdateParameters # type: ignore - from ._models import TriggerProperties # type: ignore - from ._models import TriggerUpdateParameters # type: ignore - from ._models import UserIdentityProperties # type: ignore +from ._models_py3 import AgentProperties +from ._models_py3 import Argument +from ._models_py3 import AuthInfo +from ._models_py3 import AuthInfoUpdateParameters +from ._models_py3 import BaseImageDependency +from ._models_py3 import BaseImageTrigger +from ._models_py3 import BaseImageTriggerUpdateParameters +from ._models_py3 import Credentials +from ._models_py3 import CustomRegistryCredentials +from ._models_py3 import DockerBuildRequest +from ._models_py3 import DockerBuildStep +from ._models_py3 import DockerBuildStepUpdateParameters +from ._models_py3 import EncodedTaskRunRequest +from ._models_py3 import EncodedTaskStep +from ._models_py3 import EncodedTaskStepUpdateParameters +from ._models_py3 import FileTaskRunRequest +from ._models_py3 import FileTaskStep +from ._models_py3 import FileTaskStepUpdateParameters +from ._models_py3 import IdentityProperties +from ._models_py3 import ImageDescriptor +from ._models_py3 import ImageUpdateTrigger +from ._models_py3 import PlatformProperties +from ._models_py3 import PlatformUpdateParameters +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import Run +from ._models_py3 import RunFilter +from ._models_py3 import RunGetLogResult +from ._models_py3 import RunListResult +from ._models_py3 import RunRequest +from ._models_py3 import RunUpdateParameters +from ._models_py3 import SecretObject +from ._models_py3 import SetValue +from ._models_py3 import SourceProperties +from ._models_py3 import SourceRegistryCredentials +from ._models_py3 import SourceTrigger +from ._models_py3 import SourceTriggerDescriptor +from ._models_py3 import SourceTriggerUpdateParameters +from ._models_py3 import SourceUpdateParameters +from ._models_py3 import SourceUploadDefinition +from ._models_py3 import Task +from ._models_py3 import TaskListResult +from ._models_py3 import TaskRunRequest +from ._models_py3 import TaskStepProperties +from ._models_py3 import TaskStepUpdateParameters +from ._models_py3 import TaskUpdateParameters +from ._models_py3 import TimerTrigger +from ._models_py3 import TimerTriggerDescriptor +from ._models_py3 import TimerTriggerUpdateParameters +from ._models_py3 import TriggerProperties +from ._models_py3 import TriggerUpdateParameters +from ._models_py3 import UserIdentityProperties + from ._container_registry_management_client_enums import ( Architecture, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_container_registry_management_client_enums.py index eb3cc6982886..f0aecff21d00 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_container_registry_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Architecture(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Architecture(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS architecture. """ @@ -34,28 +19,28 @@ class Architecture(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): X86 = "x86" ARM = "arm" -class BaseImageDependencyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageDependencyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the base image dependency. """ BUILD_TIME = "BuildTime" RUN_TIME = "RunTime" -class BaseImageTriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageTriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the auto trigger for base image dependency updates. """ ALL = "All" RUNTIME = "Runtime" -class OS(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OS(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system type required for the run. """ WINDOWS = "Windows" LINUX = "Linux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of a run. """ @@ -66,7 +51,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -75,7 +60,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RunStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RunStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the run. """ @@ -88,7 +73,7 @@ class RunStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" TIMEOUT = "Timeout" -class RunType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RunType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of run. """ @@ -97,7 +82,7 @@ class RunType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_BUILD = "AutoBuild" AUTO_RUN = "AutoRun" -class SecretObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretObjectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the secret object which determines how the value of the secret object has to be interpreted. """ @@ -105,14 +90,14 @@ class SecretObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OPAQUE = "Opaque" VAULTSECRET = "Vaultsecret" -class SourceControlType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceControlType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source control service. """ GITHUB = "Github" VISUAL_STUDIO_TEAM_SERVICE = "VisualStudioTeamService" -class SourceRegistryLoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceRegistryLoginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication mode which determines the source registry login scope. The credentials for the source registry will be generated using the given scope. These credentials will be used to login to @@ -122,12 +107,12 @@ class SourceRegistryLoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum NONE = "None" DEFAULT = "Default" -class SourceTriggerEvent(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceTriggerEvent(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COMMIT = "commit" PULLREQUEST = "pullrequest" -class StepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StepType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the step. """ @@ -135,28 +120,28 @@ class StepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_TASK = "FileTask" ENCODED_TASK = "EncodedTask" -class TaskStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TaskStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of task. """ DISABLED = "Disabled" ENABLED = "Enabled" -class TokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Auth token. """ PAT = "PAT" O_AUTH = "OAuth" -class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of trigger. """ DISABLED = "Disabled" ENABLED = "Enabled" -class Variant(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Variant(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Variant of the CPU. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models.py deleted file mode 100644 index 3d374e062499..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models.py +++ /dev/null @@ -1,2132 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AgentProperties(msrest.serialization.Model): - """The properties that determine the run agent configuration. - - :param cpu: The CPU configuration in terms of number of cores required for the run. - :type cpu: int - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentProperties, self).__init__(**kwargs) - self.cpu = kwargs.get('cpu', None) - - -class Argument(msrest.serialization.Model): - """The properties of a run argument. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be - removed from build logs. - :type is_secret: bool - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'is_secret': {'key': 'isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Argument, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - self.is_secret = kwargs.get('is_secret', False) - - -class AuthInfo(msrest.serialization.Model): - """The authorization properties for accessing the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int - """ - - _validation = { - 'token_type': {'required': True}, - 'token': {'required': True}, - } - - _attribute_map = { - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AuthInfo, self).__init__(**kwargs) - self.token_type = kwargs['token_type'] - self.token = kwargs['token'] - self.refresh_token = kwargs.get('refresh_token', None) - self.scope = kwargs.get('scope', None) - self.expires_in = kwargs.get('expires_in', None) - - -class AuthInfoUpdateParameters(msrest.serialization.Model): - """The authorization properties for accessing the source code repository. - - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType - :param token: The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int - """ - - _attribute_map = { - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AuthInfoUpdateParameters, self).__init__(**kwargs) - self.token_type = kwargs.get('token_type', None) - self.token = kwargs.get('token', None) - self.refresh_token = kwargs.get('refresh_token', None) - self.scope = kwargs.get('scope', None) - self.expires_in = kwargs.get('expires_in', None) - - -class BaseImageDependency(msrest.serialization.Model): - """Properties that describe a base image dependency. - - :param type: The type of the base image dependency. Possible values include: "BuildTime", - "RunTime". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageDependency, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class BaseImageTrigger(msrest.serialization.Model): - """The trigger based on base image dependency. - - All required parameters must be populated in order to send to Azure. - - :param base_image_trigger_type: Required. The type of the auto trigger for base image - dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or - ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'base_image_trigger_type': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'base_image_trigger_type': {'key': 'baseImageTriggerType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageTrigger, self).__init__(**kwargs) - self.base_image_trigger_type = kwargs['base_image_trigger_type'] - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class BaseImageTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating base image dependency trigger. - - All required parameters must be populated in order to send to Azure. - - :param base_image_trigger_type: The type of the auto trigger for base image dependency updates. - Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or - ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'base_image_trigger_type': {'key': 'baseImageTriggerType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageTriggerUpdateParameters, self).__init__(**kwargs) - self.base_image_trigger_type = kwargs.get('base_image_trigger_type', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class Credentials(msrest.serialization.Model): - """The parameters that describes a set of credentials that will be used when a run is invoked. - - :param source_registry: Describes the credential parameters for accessing the source registry. - :type source_registry: - ~azure.mgmt.containerregistry.v2019_04_01.models.SourceRegistryCredentials - :param custom_registries: Describes the credential parameters for accessing other custom - registries. The key - for the dictionary item will be the registry login server (myregistry.azurecr.io) and - the value of the item will be the registry credentials for accessing the registry. - :type custom_registries: dict[str, - ~azure.mgmt.containerregistry.v2019_04_01.models.CustomRegistryCredentials] - """ - - _attribute_map = { - 'source_registry': {'key': 'sourceRegistry', 'type': 'SourceRegistryCredentials'}, - 'custom_registries': {'key': 'customRegistries', 'type': '{CustomRegistryCredentials}'}, - } - - def __init__( - self, - **kwargs - ): - super(Credentials, self).__init__(**kwargs) - self.source_registry = kwargs.get('source_registry', None) - self.custom_registries = kwargs.get('custom_registries', None) - - -class CustomRegistryCredentials(msrest.serialization.Model): - """Describes the credentials that will be used to access a custom registry during a run. - - :param user_name: The username for logging into the custom registry. - :type user_name: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject - :param password: The password for logging into the custom registry. The password is a secret - object that allows multiple ways of providing the value for it. - :type password: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject - :param identity: Indicates the managed identity assigned to the custom credential. If a - user-assigned identity - this value is the Client ID. If a system-assigned identity, the value will be ``system``. In - the case of a system-assigned identity, the Client ID will be determined by the runner. This - identity may be used to authenticate to key vault to retrieve credentials or it may be the - only - source of authentication used for accessing the registry. - :type identity: str - """ - - _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'SecretObject'}, - 'password': {'key': 'password', 'type': 'SecretObject'}, - 'identity': {'key': 'identity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomRegistryCredentials, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.password = kwargs.get('password', None) - self.identity = kwargs.get('identity', None) - - -class RunRequest(msrest.serialization.Model): - """The request parameters for scheduling a run. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildRequest, EncodedTaskRunRequest, FileTaskRunRequest, TaskRunRequest. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - } - - _subtype_map = { - 'type': {'DockerBuildRequest': 'DockerBuildRequest', 'EncodedTaskRunRequest': 'EncodedTaskRunRequest', 'FileTaskRunRequest': 'FileTaskRunRequest', 'TaskRunRequest': 'TaskRunRequest'} - } - - def __init__( - self, - **kwargs - ): - super(RunRequest, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.is_archive_enabled = kwargs.get('is_archive_enabled', False) - - -class DockerBuildRequest(RunRequest): - """The parameters for a docker quick build. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing the run. - :type arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials - """ - - _validation = { - 'type': {'required': True}, - 'docker_file_path': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildRequest, self).__init__(**kwargs) - self.type = 'DockerBuildRequest' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.docker_file_path = kwargs['docker_file_path'] - self.target = kwargs.get('target', None) - self.arguments = kwargs.get('arguments', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class TaskStepProperties(msrest.serialization.Model): - """Base properties for any task step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStep, EncodedTaskStep, FileTaskStep. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStep', 'EncodedTask': 'EncodedTaskStep', 'FileTask': 'FileTaskStep'} - } - - def __init__( - self, - **kwargs - ): - super(TaskStepProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.base_image_dependencies = None - self.context_path = kwargs.get('context_path', None) - self.context_access_token = kwargs.get('context_access_token', None) - - -class DockerBuildStep(TaskStepProperties): - """The Docker build step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source context. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing this build - step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - 'docker_file_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStep, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.docker_file_path = kwargs['docker_file_path'] - self.target = kwargs.get('target', None) - self.arguments = kwargs.get('arguments', None) - - -class TaskStepUpdateParameters(msrest.serialization.Model): - """Base properties for updating any task step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStepUpdateParameters, EncodedTaskStepUpdateParameters, FileTaskStepUpdateParameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStepUpdateParameters', 'EncodedTask': 'EncodedTaskStepUpdateParameters', 'FileTask': 'FileTaskStepUpdateParameters'} - } - - def __init__( - self, - **kwargs - ): - super(TaskStepUpdateParameters, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.context_path = kwargs.get('context_path', None) - self.context_access_token = kwargs.get('context_access_token', None) - - -class DockerBuildStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating a docker build step. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source context. - :type docker_file_path: str - :param arguments: The collection of override arguments to be used when executing this build - step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStepUpdateParameters, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', None) - self.no_cache = kwargs.get('no_cache', None) - self.docker_file_path = kwargs.get('docker_file_path', None) - self.arguments = kwargs.get('arguments', None) - self.target = kwargs.get('target', None) - - -class EncodedTaskRunRequest(RunRequest): - """The parameters for a quick task run request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param encoded_task_content: Required. Base64 encoded value of the template/definition file - content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials - """ - - _validation = { - 'type': {'required': True}, - 'encoded_task_content': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskRunRequest, self).__init__(**kwargs) - self.type = 'EncodedTaskRunRequest' # type: str - self.encoded_task_content = kwargs['encoded_task_content'] - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class EncodedTaskStep(TaskStepProperties): - """The properties of a encoded task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file - content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - 'encoded_task_content': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskStep, self).__init__(**kwargs) - self.type = 'EncodedTask' # type: str - self.encoded_task_content = kwargs['encoded_task_content'] - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - - -class EncodedTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating encoded task step. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskStepUpdateParameters, self).__init__(**kwargs) - self.type = 'EncodedTask' # type: str - self.encoded_task_content = kwargs.get('encoded_task_content', None) - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - - -class FileTaskRunRequest(RunRequest): - """The request parameters for a scheduling run against a task file. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param task_file_path: Required. The template/definition file path relative to the source. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials - """ - - _validation = { - 'type': {'required': True}, - 'task_file_path': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskRunRequest, self).__init__(**kwargs) - self.type = 'FileTaskRunRequest' # type: str - self.task_file_path = kwargs['task_file_path'] - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class FileTaskStep(TaskStepProperties): - """The properties of a task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: Required. The task template/definition file path relative to the source - context. - :type task_file_path: str - :param values_file_path: The task values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - 'task_file_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskStep, self).__init__(**kwargs) - self.type = 'FileTask' # type: str - self.task_file_path = kwargs['task_file_path'] - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - - -class FileTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties of updating a task step. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskStepUpdateParameters, self).__init__(**kwargs) - self.type = 'FileTask' # type: str - self.task_file_path = kwargs.get('task_file_path', None) - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - - -class IdentityProperties(msrest.serialization.Model): - """Managed identity for the resource. - - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity - dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.containerregistry.v2019_04_01.models.UserIdentityProperties] - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImageDescriptor(msrest.serialization.Model): - """Properties for a registry image. - - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDescriptor, self).__init__(**kwargs) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class ImageUpdateTrigger(msrest.serialization.Model): - """The image update trigger that caused a build. - - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'images': {'key': 'images', 'type': '[ImageDescriptor]'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageUpdateTrigger, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.images = kwargs.get('images', None) - - -class PlatformProperties(msrest.serialization.Model): - """The platform properties against which the run has to happen. - - All required parameters must be populated in order to send to Azure. - - :param os: Required. The operating system type required for the run. Possible values include: - "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant - """ - - _validation = { - 'os': {'required': True}, - } - - _attribute_map = { - 'os': {'key': 'os', 'type': 'str'}, - 'architecture': {'key': 'architecture', 'type': 'str'}, - 'variant': {'key': 'variant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PlatformProperties, self).__init__(**kwargs) - self.os = kwargs['os'] - self.architecture = kwargs.get('architecture', None) - self.variant = kwargs.get('variant', None) - - -class PlatformUpdateParameters(msrest.serialization.Model): - """The properties for updating the platform configuration. - - :param os: The operating system type required for the run. Possible values include: "Windows", - "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant - """ - - _attribute_map = { - 'os': {'key': 'os', 'type': 'str'}, - 'architecture': {'key': 'architecture', 'type': 'str'}, - 'variant': {'key': 'variant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PlatformUpdateParameters, self).__init__(**kwargs) - self.os = kwargs.get('os', None) - self.architecture = kwargs.get('architecture', None) - self.variant = kwargs.get('variant', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class Run(ProxyResource): - """Run resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param run_id: The unique identifier for the run. - :type run_id: str - :param status: The current status of the run. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus - :param last_updated_time: The last updated time for the run. - :type last_updated_time: ~datetime.datetime - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", - "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType - :param create_time: The time the run was scheduled. - :type create_time: ~datetime.datetime - :param start_time: The time the run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the run. This is - applicable if the run generates base image dependencies. - :type output_images: list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] - :param task: The task against which run was scheduled. - :type task: str - :param image_update_trigger: The image update trigger that caused the run. This is applicable - if the task has base image trigger configured. - :type image_update_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.ImageUpdateTrigger - :param source_trigger: The source trigger that caused the run. - :type source_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerDescriptor - :param platform: The platform properties against which the run will happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_registry_auth: The scope of the credentials that were used to login to the source - registry during this run. - :type source_registry_auth: str - :param custom_registries: The list of custom registries that were logged in during this run. - :type custom_registries: list[str] - :ivar run_error_message: The error message received from backend systems after the run is - scheduled. - :vartype run_error_message: str - :param provisioning_state: The provisioning state of a run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_04_01.models.ProvisioningState - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param timer_trigger: The timer trigger that caused the run. - :type timer_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TimerTriggerDescriptor - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'run_error_message': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'run_id': {'key': 'properties.runId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, - 'run_type': {'key': 'properties.runType', 'type': 'str'}, - 'create_time': {'key': 'properties.createTime', 'type': 'iso-8601'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'properties.finishTime', 'type': 'iso-8601'}, - 'output_images': {'key': 'properties.outputImages', 'type': '[ImageDescriptor]'}, - 'task': {'key': 'properties.task', 'type': 'str'}, - 'image_update_trigger': {'key': 'properties.imageUpdateTrigger', 'type': 'ImageUpdateTrigger'}, - 'source_trigger': {'key': 'properties.sourceTrigger', 'type': 'SourceTriggerDescriptor'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'source_registry_auth': {'key': 'properties.sourceRegistryAuth', 'type': 'str'}, - 'custom_registries': {'key': 'properties.customRegistries', 'type': '[str]'}, - 'run_error_message': {'key': 'properties.runErrorMessage', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'is_archive_enabled': {'key': 'properties.isArchiveEnabled', 'type': 'bool'}, - 'timer_trigger': {'key': 'properties.timerTrigger', 'type': 'TimerTriggerDescriptor'}, - } - - def __init__( - self, - **kwargs - ): - super(Run, self).__init__(**kwargs) - self.run_id = kwargs.get('run_id', None) - self.status = kwargs.get('status', None) - self.last_updated_time = kwargs.get('last_updated_time', None) - self.run_type = kwargs.get('run_type', None) - self.create_time = kwargs.get('create_time', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_images = kwargs.get('output_images', None) - self.task = kwargs.get('task', None) - self.image_update_trigger = kwargs.get('image_update_trigger', None) - self.source_trigger = kwargs.get('source_trigger', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_registry_auth = kwargs.get('source_registry_auth', None) - self.custom_registries = kwargs.get('custom_registries', None) - self.run_error_message = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', False) - self.timer_trigger = kwargs.get('timer_trigger', None) - - -class RunFilter(msrest.serialization.Model): - """Properties that are enabled for Odata querying on runs. - - :param run_id: The unique identifier for the run. - :type run_id: str - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", - "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType - :param status: The current status of the run. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus - :param create_time: The create time for a run. - :type create_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated - from the run. This is applicable if the run is of - build type. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param task_name: The name of the task that the run corresponds to. - :type task_name: str - """ - - _attribute_map = { - 'run_id': {'key': 'runId', 'type': 'str'}, - 'run_type': {'key': 'runType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'create_time': {'key': 'createTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'output_image_manifests': {'key': 'outputImageManifests', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'task_name': {'key': 'taskName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunFilter, self).__init__(**kwargs) - self.run_id = kwargs.get('run_id', None) - self.run_type = kwargs.get('run_type', None) - self.status = kwargs.get('status', None) - self.create_time = kwargs.get('create_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_image_manifests = kwargs.get('output_image_manifests', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - self.task_name = kwargs.get('task_name', None) - - -class RunGetLogResult(msrest.serialization.Model): - """The result of get log link operation. - - :param log_link: The link to logs for a run on a azure container registry. - :type log_link: str - """ - - _attribute_map = { - 'log_link': {'key': 'logLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunGetLogResult, self).__init__(**kwargs) - self.log_link = kwargs.get('log_link', None) - - -class RunListResult(msrest.serialization.Model): - """Collection of runs. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Run] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Run]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RunUpdateParameters(msrest.serialization.Model): - """The set of run properties that can be updated. - - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - """ - - _attribute_map = { - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RunUpdateParameters, self).__init__(**kwargs) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - - -class SecretObject(msrest.serialization.Model): - """Describes the properties of a secret object value. - - :param value: The value of the secret. The format of this value will be determined - based on the type of the secret object. If the type is Opaque, the value will be - used as is without any modification. - :type value: str - :param type: The type of the secret object which determines how the value of the secret object - has to be - interpreted. Possible values include: "Opaque", "Vaultsecret". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObjectType - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretObject, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.type = kwargs.get('type', None) - - -class SetValue(msrest.serialization.Model): - """The properties of a overridable value that can be passed to a task template. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the overridable value. - :type name: str - :param value: Required. The overridable value. - :type value: str - :param is_secret: Flag to indicate whether the value represents a secret or not. - :type is_secret: bool - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'is_secret': {'key': 'isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SetValue, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - self.is_secret = kwargs.get('is_secret', False) - - -class SourceProperties(msrest.serialization.Model): - """The properties of the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param source_control_type: Required. The type of source control service. Possible values - include: "Github", "VisualStudioTeamService". - :type source_control_type: str or - ~azure.mgmt.containerregistry.v2019_04_01.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source - code repository and to set up - webhooks for notifications. - :type source_control_auth_properties: ~azure.mgmt.containerregistry.v2019_04_01.models.AuthInfo - """ - - _validation = { - 'source_control_type': {'required': True}, - 'repository_url': {'required': True}, - } - - _attribute_map = { - 'source_control_type': {'key': 'sourceControlType', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'AuthInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceProperties, self).__init__(**kwargs) - self.source_control_type = kwargs['source_control_type'] - self.repository_url = kwargs['repository_url'] - self.branch = kwargs.get('branch', None) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - - -class SourceRegistryCredentials(msrest.serialization.Model): - """Describes the credential parameters for accessing the source registry. - - :param login_mode: The authentication mode which determines the source registry login scope. - The credentials for the source registry - will be generated using the given scope. These credentials will be used to login to - the source registry during the run. Possible values include: "None", "Default". - :type login_mode: str or - ~azure.mgmt.containerregistry.v2019_04_01.models.SourceRegistryLoginMode - """ - - _attribute_map = { - 'login_mode': {'key': 'loginMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceRegistryCredentials, self).__init__(**kwargs) - self.login_mode = kwargs.get('login_mode', None) - - -class SourceTrigger(msrest.serialization.Model): - """The properties of a source based trigger. - - All required parameters must be populated in order to send to Azure. - - :param source_repository: Required. The properties that describes the source(code) for the - task. - :type source_repository: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceProperties - :param source_trigger_events: Required. The source event corresponding to the trigger. - :type source_trigger_events: list[str or - ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'source_repository': {'required': True}, - 'source_trigger_events': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'source_repository': {'key': 'sourceRepository', 'type': 'SourceProperties'}, - 'source_trigger_events': {'key': 'sourceTriggerEvents', 'type': '[str]'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTrigger, self).__init__(**kwargs) - self.source_repository = kwargs['source_repository'] - self.source_trigger_events = kwargs['source_trigger_events'] - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class SourceTriggerDescriptor(msrest.serialization.Model): - """The source trigger that caused a run. - - :param id: The unique ID of the trigger. - :type id: str - :param event_type: The event type of the trigger. - :type event_type: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param pull_request_id: The unique ID that identifies pull request. - :type pull_request_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'commit_id': {'key': 'commitId', 'type': 'str'}, - 'pull_request_id': {'key': 'pullRequestId', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch_name': {'key': 'branchName', 'type': 'str'}, - 'provider_type': {'key': 'providerType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTriggerDescriptor, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.event_type = kwargs.get('event_type', None) - self.commit_id = kwargs.get('commit_id', None) - self.pull_request_id = kwargs.get('pull_request_id', None) - self.repository_url = kwargs.get('repository_url', None) - self.branch_name = kwargs.get('branch_name', None) - self.provider_type = kwargs.get('provider_type', None) - - -class SourceTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating a source based trigger. - - All required parameters must be populated in order to send to Azure. - - :param source_repository: The properties that describes the source(code) for the task. - :type source_repository: - ~azure.mgmt.containerregistry.v2019_04_01.models.SourceUpdateParameters - :param source_trigger_events: The source event corresponding to the trigger. - :type source_trigger_events: list[str or - ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'source_repository': {'key': 'sourceRepository', 'type': 'SourceUpdateParameters'}, - 'source_trigger_events': {'key': 'sourceTriggerEvents', 'type': '[str]'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTriggerUpdateParameters, self).__init__(**kwargs) - self.source_repository = kwargs.get('source_repository', None) - self.source_trigger_events = kwargs.get('source_trigger_events', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class SourceUpdateParameters(msrest.serialization.Model): - """The properties for updating the source code repository. - - :param source_control_type: The type of source control service. Possible values include: - "Github", "VisualStudioTeamService". - :type source_control_type: str or - ~azure.mgmt.containerregistry.v2019_04_01.models.SourceControlType - :param repository_url: The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source - code repository and to set up - webhooks for notifications. - :type source_control_auth_properties: - ~azure.mgmt.containerregistry.v2019_04_01.models.AuthInfoUpdateParameters - """ - - _attribute_map = { - 'source_control_type': {'key': 'sourceControlType', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'AuthInfoUpdateParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceUpdateParameters, self).__init__(**kwargs) - self.source_control_type = kwargs.get('source_control_type', None) - self.repository_url = kwargs.get('repository_url', None) - self.branch = kwargs.get('branch', None) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - - -class SourceUploadDefinition(msrest.serialization.Model): - """The properties of a response to source upload request. - - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent - queue build request. - :type relative_path: str - """ - - _attribute_map = { - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceUploadDefinition, self).__init__(**kwargs) - self.upload_url = kwargs.get('upload_url', None) - self.relative_path = kwargs.get('relative_path', None) - - -class Task(Resource): - """The task that has the ARM resource and task properties. -The task will have all information to schedule a run against it. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties - :ivar provisioning_state: The provisioning state of the task. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_04_01.models.ProvisioningState - :ivar creation_date: The creation date of task. - :vartype creation_date: ~datetime.datetime - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties of a task step. - :type step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepProperties - :param trigger: The properties that describe all triggers for the task. - :type trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerProperties - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - 'step': {'key': 'properties.step', 'type': 'TaskStepProperties'}, - 'trigger': {'key': 'properties.trigger', 'type': 'TriggerProperties'}, - 'credentials': {'key': 'properties.credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(Task, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.creation_date = None - self.status = kwargs.get('status', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.timeout = kwargs.get('timeout', 3600) - self.step = kwargs.get('step', None) - self.trigger = kwargs.get('trigger', None) - self.credentials = kwargs.get('credentials', None) - - -class TaskListResult(msrest.serialization.Model): - """The collection of tasks. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Task] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Task]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TaskRunRequest(RunRequest): - """The parameters for a task run request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param task_name: Required. The name of task against which run has to be queued. - :type task_name: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - 'task_name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'task_name': {'key': 'taskName', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskRunRequest, self).__init__(**kwargs) - self.type = 'TaskRunRequest' # type: str - self.task_name = kwargs['task_name'] - self.values = kwargs.get('values', None) - - -class TaskUpdateParameters(msrest.serialization.Model): - """The parameters for updating a task. - - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformUpdateParameters - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties for updating a task step. - :type step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepUpdateParameters - :param trigger: The properties for updating trigger properties. - :type trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerUpdateParameters - :param credentials: The parameters that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformUpdateParameters'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - 'step': {'key': 'properties.step', 'type': 'TaskStepUpdateParameters'}, - 'trigger': {'key': 'properties.trigger', 'type': 'TriggerUpdateParameters'}, - 'credentials': {'key': 'properties.credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskUpdateParameters, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - self.status = kwargs.get('status', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.timeout = kwargs.get('timeout', None) - self.step = kwargs.get('step', None) - self.trigger = kwargs.get('trigger', None) - self.credentials = kwargs.get('credentials', None) - - -class TimerTrigger(msrest.serialization.Model): - """The properties of a timer trigger. - - All required parameters must be populated in order to send to Azure. - - :param schedule: Required. The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'schedule': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TimerTrigger, self).__init__(**kwargs) - self.schedule = kwargs['schedule'] - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class TimerTriggerDescriptor(msrest.serialization.Model): - """TimerTriggerDescriptor. - - :param timer_trigger_name: The timer trigger name that caused the run. - :type timer_trigger_name: str - :param schedule_occurrence: The occurrence that triggered the run. - :type schedule_occurrence: str - """ - - _attribute_map = { - 'timer_trigger_name': {'key': 'timerTriggerName', 'type': 'str'}, - 'schedule_occurrence': {'key': 'scheduleOccurrence', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TimerTriggerDescriptor, self).__init__(**kwargs) - self.timer_trigger_name = kwargs.get('timer_trigger_name', None) - self.schedule_occurrence = kwargs.get('schedule_occurrence', None) - - -class TimerTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating a timer trigger. - - All required parameters must be populated in order to send to Azure. - - :param schedule: The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TimerTriggerUpdateParameters, self).__init__(**kwargs) - self.schedule = kwargs.get('schedule', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class TriggerProperties(msrest.serialization.Model): - """The properties of a trigger. - - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.TimerTrigger] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.SourceTrigger] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTrigger - """ - - _attribute_map = { - 'timer_triggers': {'key': 'timerTriggers', 'type': '[TimerTrigger]'}, - 'source_triggers': {'key': 'sourceTriggers', 'type': '[SourceTrigger]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'BaseImageTrigger'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerProperties, self).__init__(**kwargs) - self.timer_triggers = kwargs.get('timer_triggers', None) - self.source_triggers = kwargs.get('source_triggers', None) - self.base_image_trigger = kwargs.get('base_image_trigger', None) - - -class TriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating triggers. - - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: - list[~azure.mgmt.containerregistry.v2019_04_01.models.TimerTriggerUpdateParameters] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: - list[~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerUpdateParameters] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: - ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerUpdateParameters - """ - - _attribute_map = { - 'timer_triggers': {'key': 'timerTriggers', 'type': '[TimerTriggerUpdateParameters]'}, - 'source_triggers': {'key': 'sourceTriggers', 'type': '[SourceTriggerUpdateParameters]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'BaseImageTriggerUpdateParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerUpdateParameters, self).__init__(**kwargs) - self.timer_triggers = kwargs.get('timer_triggers', None) - self.source_triggers = kwargs.get('source_triggers', None) - self.base_image_trigger = kwargs.get('base_image_trigger', None) - - -class UserIdentityProperties(msrest.serialization.Model): - """UserIdentityProperties. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models_py3.py index 4fe58ceea5e2..0958de68e6c7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/models/_models_py3.py @@ -17,8 +17,8 @@ class AgentProperties(msrest.serialization.Model): """The properties that determine the run agent configuration. - :param cpu: The CPU configuration in terms of number of cores required for the run. - :type cpu: int + :ivar cpu: The CPU configuration in terms of number of cores required for the run. + :vartype cpu: int """ _attribute_map = { @@ -31,6 +31,10 @@ def __init__( cpu: Optional[int] = None, **kwargs ): + """ + :keyword cpu: The CPU configuration in terms of number of cores required for the run. + :paramtype cpu: int + """ super(AgentProperties, self).__init__(**kwargs) self.cpu = cpu @@ -40,13 +44,13 @@ class Argument(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be + :ivar name: Required. The name of the argument. + :vartype name: str + :ivar value: Required. The value of the argument. + :vartype value: str + :ivar is_secret: Flag to indicate whether the argument represents a secret and want to be removed from build logs. - :type is_secret: bool + :vartype is_secret: bool """ _validation = { @@ -68,6 +72,15 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The name of the argument. + :paramtype name: str + :keyword value: Required. The value of the argument. + :paramtype value: str + :keyword is_secret: Flag to indicate whether the argument represents a secret and want to be + removed from build logs. + :paramtype is_secret: bool + """ super(Argument, self).__init__(**kwargs) self.name = name self.value = value @@ -79,16 +92,16 @@ class AuthInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int + :ivar token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". + :vartype token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType + :ivar token: Required. The access token used to access the source control provider. + :vartype token: str + :ivar refresh_token: The refresh token used to refresh the access token. + :vartype refresh_token: str + :ivar scope: The scope of the access token. + :vartype scope: str + :ivar expires_in: Time in seconds that the token remains valid. + :vartype expires_in: int """ _validation = { @@ -114,6 +127,18 @@ def __init__( expires_in: Optional[int] = None, **kwargs ): + """ + :keyword token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". + :paramtype token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType + :keyword token: Required. The access token used to access the source control provider. + :paramtype token: str + :keyword refresh_token: The refresh token used to refresh the access token. + :paramtype refresh_token: str + :keyword scope: The scope of the access token. + :paramtype scope: str + :keyword expires_in: Time in seconds that the token remains valid. + :paramtype expires_in: int + """ super(AuthInfo, self).__init__(**kwargs) self.token_type = token_type self.token = token @@ -125,16 +150,16 @@ def __init__( class AuthInfoUpdateParameters(msrest.serialization.Model): """The authorization properties for accessing the source code repository. - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType - :param token: The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int + :ivar token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :vartype token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType + :ivar token: The access token used to access the source control provider. + :vartype token: str + :ivar refresh_token: The refresh token used to refresh the access token. + :vartype refresh_token: str + :ivar scope: The scope of the access token. + :vartype scope: str + :ivar expires_in: Time in seconds that the token remains valid. + :vartype expires_in: int """ _attribute_map = { @@ -155,6 +180,18 @@ def __init__( expires_in: Optional[int] = None, **kwargs ): + """ + :keyword token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :paramtype token_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TokenType + :keyword token: The access token used to access the source control provider. + :paramtype token: str + :keyword refresh_token: The refresh token used to refresh the access token. + :paramtype refresh_token: str + :keyword scope: The scope of the access token. + :paramtype scope: str + :keyword expires_in: Time in seconds that the token remains valid. + :paramtype expires_in: int + """ super(AuthInfoUpdateParameters, self).__init__(**kwargs) self.token_type = token_type self.token = token @@ -166,17 +203,17 @@ def __init__( class BaseImageDependency(msrest.serialization.Model): """Properties that describe a base image dependency. - :param type: The type of the base image dependency. Possible values include: "BuildTime", + :ivar type: The type of the base image dependency. Possible values include: "BuildTime", "RunTime". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependencyType + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -197,6 +234,20 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the base image dependency. Possible values include: "BuildTime", + "RunTime". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependencyType + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(BaseImageDependency, self).__init__(**kwargs) self.type = type self.registry = registry @@ -210,14 +261,14 @@ class BaseImageTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param base_image_trigger_type: Required. The type of the auto trigger for base image - dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or + :ivar base_image_trigger_type: Required. The type of the auto trigger for base image dependency + updates. Possible values include: "All", "Runtime". + :vartype base_image_trigger_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -239,6 +290,16 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword base_image_trigger_type: Required. The type of the auto trigger for base image + dependency updates. Possible values include: "All", "Runtime". + :paramtype base_image_trigger_type: str or + ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerType + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(BaseImageTrigger, self).__init__(**kwargs) self.base_image_trigger_type = base_image_trigger_type self.status = status @@ -250,14 +311,14 @@ class BaseImageTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param base_image_trigger_type: The type of the auto trigger for base image dependency updates. + :ivar base_image_trigger_type: The type of the auto trigger for base image dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or + :vartype base_image_trigger_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -278,6 +339,16 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword base_image_trigger_type: The type of the auto trigger for base image dependency + updates. Possible values include: "All", "Runtime". + :paramtype base_image_trigger_type: str or + ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerType + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(BaseImageTriggerUpdateParameters, self).__init__(**kwargs) self.base_image_trigger_type = base_image_trigger_type self.status = status @@ -287,14 +358,14 @@ def __init__( class Credentials(msrest.serialization.Model): """The parameters that describes a set of credentials that will be used when a run is invoked. - :param source_registry: Describes the credential parameters for accessing the source registry. - :type source_registry: + :ivar source_registry: Describes the credential parameters for accessing the source registry. + :vartype source_registry: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceRegistryCredentials - :param custom_registries: Describes the credential parameters for accessing other custom + :ivar custom_registries: Describes the credential parameters for accessing other custom registries. The key for the dictionary item will be the registry login server (myregistry.azurecr.io) and the value of the item will be the registry credentials for accessing the registry. - :type custom_registries: dict[str, + :vartype custom_registries: dict[str, ~azure.mgmt.containerregistry.v2019_04_01.models.CustomRegistryCredentials] """ @@ -310,6 +381,18 @@ def __init__( custom_registries: Optional[Dict[str, "CustomRegistryCredentials"]] = None, **kwargs ): + """ + :keyword source_registry: Describes the credential parameters for accessing the source + registry. + :paramtype source_registry: + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceRegistryCredentials + :keyword custom_registries: Describes the credential parameters for accessing other custom + registries. The key + for the dictionary item will be the registry login server (myregistry.azurecr.io) and + the value of the item will be the registry credentials for accessing the registry. + :paramtype custom_registries: dict[str, + ~azure.mgmt.containerregistry.v2019_04_01.models.CustomRegistryCredentials] + """ super(Credentials, self).__init__(**kwargs) self.source_registry = source_registry self.custom_registries = custom_registries @@ -318,19 +401,19 @@ def __init__( class CustomRegistryCredentials(msrest.serialization.Model): """Describes the credentials that will be used to access a custom registry during a run. - :param user_name: The username for logging into the custom registry. - :type user_name: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject - :param password: The password for logging into the custom registry. The password is a secret + :ivar user_name: The username for logging into the custom registry. + :vartype user_name: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject + :ivar password: The password for logging into the custom registry. The password is a secret object that allows multiple ways of providing the value for it. - :type password: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject - :param identity: Indicates the managed identity assigned to the custom credential. If a + :vartype password: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject + :ivar identity: Indicates the managed identity assigned to the custom credential. If a user-assigned identity this value is the Client ID. If a system-assigned identity, the value will be ``system``. In the case of a system-assigned identity, the Client ID will be determined by the runner. This identity may be used to authenticate to key vault to retrieve credentials or it may be the only source of authentication used for accessing the registry. - :type identity: str + :vartype identity: str """ _attribute_map = { @@ -347,6 +430,21 @@ def __init__( identity: Optional[str] = None, **kwargs ): + """ + :keyword user_name: The username for logging into the custom registry. + :paramtype user_name: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject + :keyword password: The password for logging into the custom registry. The password is a secret + object that allows multiple ways of providing the value for it. + :paramtype password: ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObject + :keyword identity: Indicates the managed identity assigned to the custom credential. If a + user-assigned identity + this value is the Client ID. If a system-assigned identity, the value will be ``system``. In + the case of a system-assigned identity, the Client ID will be determined by the runner. This + identity may be used to authenticate to key vault to retrieve credentials or it may be the + only + source of authentication used for accessing the registry. + :paramtype identity: str + """ super(CustomRegistryCredentials, self).__init__(**kwargs) self.user_name = user_name self.password = password @@ -361,11 +459,11 @@ class RunRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool + :vartype is_archive_enabled: bool """ _validation = { @@ -387,6 +485,11 @@ def __init__( is_archive_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + """ super(RunRequest, self).__init__(**kwargs) self.type = None # type: Optional[str] self.is_archive_enabled = is_archive_enabled @@ -397,39 +500,38 @@ class DockerBuildRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :vartype is_archive_enabled: bool + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing the run. - :type arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: Required. The Docker file path relative to the source location. + :vartype docker_file_path: str + :ivar target: The name of the target build stage for the docker build. + :vartype target: str + :ivar arguments: The collection of override arguments to be used when executing the run. + :vartype arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials """ _validation = { @@ -472,6 +574,40 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: Required. The Docker file path relative to the source location. + :paramtype docker_file_path: str + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + :keyword arguments: The collection of override arguments to be used when executing the run. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + """ super(DockerBuildRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'DockerBuildRequest' # type: str self.image_names = image_names @@ -497,17 +633,17 @@ class TaskStepProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str """ _validation = { @@ -533,6 +669,13 @@ def __init__( context_access_token: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + """ super(TaskStepProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.base_image_dependencies = None @@ -547,32 +690,31 @@ class DockerBuildStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source context. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing this build + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: Required. The Docker file path relative to the source context. + :vartype docker_file_path: str + :ivar target: The name of the target build stage for the docker build. + :vartype target: str + :ivar arguments: The collection of override arguments to be used when executing this build step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] + :vartype arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] """ _validation = { @@ -607,6 +749,28 @@ def __init__( arguments: Optional[List["Argument"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: Required. The Docker file path relative to the source context. + :paramtype docker_file_path: str + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + :keyword arguments: The collection of override arguments to be used when executing this build + step. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] + """ super(DockerBuildStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'Docker' # type: str self.image_names = image_names @@ -625,14 +789,14 @@ class TaskStepUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str """ _validation = { @@ -656,6 +820,13 @@ def __init__( context_access_token: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + """ super(TaskStepUpdateParameters, self).__init__(**kwargs) self.type = None # type: Optional[str] self.context_path = context_path @@ -667,29 +838,28 @@ class DockerBuildStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source context. - :type docker_file_path: str - :param arguments: The collection of override arguments to be used when executing this build + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: The Docker file path relative to the source context. + :vartype docker_file_path: str + :ivar arguments: The collection of override arguments to be used when executing this build step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str + :vartype arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] + :ivar target: The name of the target build stage for the docker build. + :vartype target: str """ _validation = { @@ -721,6 +891,28 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: The Docker file path relative to the source context. + :paramtype docker_file_path: str + :keyword arguments: The collection of override arguments to be used when executing this build + step. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2019_04_01.models.Argument] + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + """ super(DockerBuildStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'Docker' # type: str self.image_names = image_names @@ -736,32 +928,32 @@ class EncodedTaskRunRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param encoded_task_content: Required. Base64 encoded value of the template/definition file + :vartype is_archive_enabled: bool + :ivar encoded_task_content: Required. Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials """ _validation = { @@ -798,6 +990,33 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword encoded_task_content: Required. Base64 encoded value of the template/definition file + content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + """ super(EncodedTaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'EncodedTaskRunRequest' # type: str self.encoded_task_content = encoded_task_content @@ -817,24 +1036,24 @@ class EncodedTaskStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar encoded_task_content: Required. Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] """ _validation = { @@ -863,6 +1082,20 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword encoded_task_content: Required. Base64 encoded value of the template/definition file + content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + """ super(EncodedTaskStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'EncodedTask' # type: str self.encoded_task_content = encoded_task_content @@ -875,20 +1108,20 @@ class EncodedTaskStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar encoded_task_content: Base64 encoded value of the template/definition file content. + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] """ _validation = { @@ -914,6 +1147,19 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword encoded_task_content: Base64 encoded value of the template/definition file content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + """ super(EncodedTaskStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'EncodedTask' # type: str self.encoded_task_content = encoded_task_content @@ -926,31 +1172,31 @@ class FileTaskRunRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param task_file_path: Required. The template/definition file path relative to the source. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :vartype is_archive_enabled: bool + :ivar task_file_path: Required. The template/definition file path relative to the source. + :vartype task_file_path: str + :ivar values_file_path: The values/parameters file path relative to the source. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials """ _validation = { @@ -987,6 +1233,32 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword task_file_path: Required. The template/definition file path relative to the source. + :paramtype task_file_path: str + :keyword values_file_path: The values/parameters file path relative to the source. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + """ super(FileTaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'FileTaskRunRequest' # type: str self.task_file_path = task_file_path @@ -1006,24 +1278,24 @@ class FileTaskStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: Required. The task template/definition file path relative to the source + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar task_file_path: Required. The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The task values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :vartype task_file_path: str + :ivar values_file_path: The task values/parameters file path relative to the source context. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] """ _validation = { @@ -1052,6 +1324,20 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword task_file_path: Required. The task template/definition file path relative to the + source context. + :paramtype task_file_path: str + :keyword values_file_path: The task values/parameters file path relative to the source context. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + """ super(FileTaskStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'FileTask' # type: str self.task_file_path = task_file_path @@ -1064,20 +1350,20 @@ class FileTaskStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar task_file_path: The task template/definition file path relative to the source context. + :vartype task_file_path: str + :ivar values_file_path: The values/parameters file path relative to the source context. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] """ _validation = { @@ -1103,6 +1389,19 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword task_file_path: The task template/definition file path relative to the source context. + :paramtype task_file_path: str + :keyword values_file_path: The values/parameters file path relative to the source context. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + """ super(FileTaskStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'FileTask' # type: str self.task_file_path = task_file_path @@ -1113,19 +1412,19 @@ def __init__( class IdentityProperties(msrest.serialization.Model): """Managed identity for the resource. - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.containerregistry.v2019_04_01.models.UserIdentityProperties] """ @@ -1145,6 +1444,22 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2019_04_01.models.UserIdentityProperties] + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id @@ -1155,14 +1470,14 @@ def __init__( class ImageDescriptor(msrest.serialization.Model): """Properties for a registry image. - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -1181,6 +1496,16 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(ImageDescriptor, self).__init__(**kwargs) self.registry = registry self.repository = repository @@ -1191,12 +1516,12 @@ def __init__( class ImageUpdateTrigger(msrest.serialization.Model): """The image update trigger that caused a build. - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar timestamp: The timestamp when the image update happened. + :vartype timestamp: ~datetime.datetime + :ivar images: The list of image updates that caused the build. + :vartype images: list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] """ _attribute_map = { @@ -1213,6 +1538,14 @@ def __init__( images: Optional[List["ImageDescriptor"]] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword timestamp: The timestamp when the image update happened. + :paramtype timestamp: ~datetime.datetime + :keyword images: The list of image updates that caused the build. + :paramtype images: list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] + """ super(ImageUpdateTrigger, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -1224,13 +1557,13 @@ class PlatformProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os: Required. The operating system type required for the run. Possible values include: + :ivar os: Required. The operating system type required for the run. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant + :vartype os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS + :ivar architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :vartype architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture + :ivar variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :vartype variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant """ _validation = { @@ -1251,6 +1584,15 @@ def __init__( variant: Optional[Union[str, "Variant"]] = None, **kwargs ): + """ + :keyword os: Required. The operating system type required for the run. Possible values include: + "Windows", "Linux". + :paramtype os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS + :keyword architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :paramtype architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture + :keyword variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :paramtype variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant + """ super(PlatformProperties, self).__init__(**kwargs) self.os = os self.architecture = architecture @@ -1260,13 +1602,13 @@ def __init__( class PlatformUpdateParameters(msrest.serialization.Model): """The properties for updating the platform configuration. - :param os: The operating system type required for the run. Possible values include: "Windows", + :ivar os: The operating system type required for the run. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". - :type architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant + :vartype os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS + :ivar architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :vartype architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture + :ivar variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :vartype variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant """ _attribute_map = { @@ -1283,6 +1625,15 @@ def __init__( variant: Optional[Union[str, "Variant"]] = None, **kwargs ): + """ + :keyword os: The operating system type required for the run. Possible values include: + "Windows", "Linux". + :paramtype os: str or ~azure.mgmt.containerregistry.v2019_04_01.models.OS + :keyword architecture: The OS architecture. Possible values include: "amd64", "x86", "arm". + :paramtype architecture: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Architecture + :keyword variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :paramtype variant: str or ~azure.mgmt.containerregistry.v2019_04_01.models.Variant + """ super(PlatformUpdateParameters, self).__init__(**kwargs) self.os = os self.architecture = architecture @@ -1318,6 +1669,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1337,11 +1690,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -1366,6 +1719,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1385,52 +1745,54 @@ class Run(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param run_id: The unique identifier for the run. - :type run_id: str - :param status: The current status of the run. Possible values include: "Queued", "Started", + :ivar run_id: The unique identifier for the run. + :vartype run_id: str + :ivar status: The current status of the run. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus - :param last_updated_time: The last updated time for the run. - :type last_updated_time: ~datetime.datetime - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus + :ivar last_updated_time: The last updated time for the run. + :vartype last_updated_time: ~datetime.datetime + :ivar run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType - :param create_time: The time the run was scheduled. - :type create_time: ~datetime.datetime - :param start_time: The time the run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the run. This is + :vartype run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType + :ivar create_time: The time the run was scheduled. + :vartype create_time: ~datetime.datetime + :ivar start_time: The time the run started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the run finished. + :vartype finish_time: ~datetime.datetime + :ivar output_images: The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - :type output_images: list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] - :param task: The task against which run was scheduled. - :type task: str - :param image_update_trigger: The image update trigger that caused the run. This is applicable - if the task has base image trigger configured. - :type image_update_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.ImageUpdateTrigger - :param source_trigger: The source trigger that caused the run. - :type source_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerDescriptor - :param platform: The platform properties against which the run will happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param source_registry_auth: The scope of the credentials that were used to login to the source + :vartype output_images: list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] + :ivar task: The task against which run was scheduled. + :vartype task: str + :ivar image_update_trigger: The image update trigger that caused the run. This is applicable if + the task has base image trigger configured. + :vartype image_update_trigger: + ~azure.mgmt.containerregistry.v2019_04_01.models.ImageUpdateTrigger + :ivar source_trigger: The source trigger that caused the run. + :vartype source_trigger: + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerDescriptor + :ivar platform: The platform properties against which the run will happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :ivar source_registry_auth: The scope of the credentials that were used to login to the source registry during this run. - :type source_registry_auth: str - :param custom_registries: The list of custom registries that were logged in during this run. - :type custom_registries: list[str] + :vartype source_registry_auth: str + :ivar custom_registries: The list of custom registries that were logged in during this run. + :vartype custom_registries: list[str] :ivar run_error_message: The error message received from backend systems after the run is scheduled. :vartype run_error_message: str - :param provisioning_state: The provisioning state of a run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or + :ivar provisioning_state: The provisioning state of a run. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_04_01.models.ProvisioningState - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param timer_trigger: The timer trigger that caused the run. - :type timer_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TimerTriggerDescriptor + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool + :ivar timer_trigger: The timer trigger that caused the run. + :vartype timer_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TimerTriggerDescriptor """ _validation = { @@ -1488,6 +1850,56 @@ def __init__( timer_trigger: Optional["TimerTriggerDescriptor"] = None, **kwargs ): + """ + :keyword run_id: The unique identifier for the run. + :paramtype run_id: str + :keyword status: The current status of the run. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus + :keyword last_updated_time: The last updated time for the run. + :paramtype last_updated_time: ~datetime.datetime + :keyword run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + "AutoBuild", "AutoRun". + :paramtype run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType + :keyword create_time: The time the run was scheduled. + :paramtype create_time: ~datetime.datetime + :keyword start_time: The time the run started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the run finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_images: The list of all images that were generated from the run. This is + applicable if the run generates base image dependencies. + :paramtype output_images: + list[~azure.mgmt.containerregistry.v2019_04_01.models.ImageDescriptor] + :keyword task: The task against which run was scheduled. + :paramtype task: str + :keyword image_update_trigger: The image update trigger that caused the run. This is applicable + if the task has base image trigger configured. + :paramtype image_update_trigger: + ~azure.mgmt.containerregistry.v2019_04_01.models.ImageUpdateTrigger + :keyword source_trigger: The source trigger that caused the run. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerDescriptor + :keyword platform: The platform properties against which the run will happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :keyword source_registry_auth: The scope of the credentials that were used to login to the + source registry during this run. + :paramtype source_registry_auth: str + :keyword custom_registries: The list of custom registries that were logged in during this run. + :paramtype custom_registries: list[str] + :keyword provisioning_state: The provisioning state of a run. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.containerregistry.v2019_04_01.models.ProvisioningState + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + :keyword timer_trigger: The timer trigger that caused the run. + :paramtype timer_trigger: + ~azure.mgmt.containerregistry.v2019_04_01.models.TimerTriggerDescriptor + """ super(Run, self).__init__(**kwargs) self.run_id = run_id self.status = status @@ -1513,26 +1925,26 @@ def __init__( class RunFilter(msrest.serialization.Model): """Properties that are enabled for Odata querying on runs. - :param run_id: The unique identifier for the run. - :type run_id: str - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + :ivar run_id: The unique identifier for the run. + :vartype run_id: str + :ivar run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType - :param status: The current status of the run. Possible values include: "Queued", "Started", + :vartype run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType + :ivar status: The current status of the run. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus - :param create_time: The create time for a run. - :type create_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus + :ivar create_time: The create time for a run. + :vartype create_time: ~datetime.datetime + :ivar finish_time: The time the run finished. + :vartype finish_time: ~datetime.datetime + :ivar output_image_manifests: The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of build type. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param task_name: The name of the task that the run corresponds to. - :type task_name: str + :vartype output_image_manifests: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool + :ivar task_name: The name of the task that the run corresponds to. + :vartype task_name: str """ _attribute_map = { @@ -1559,6 +1971,28 @@ def __init__( task_name: Optional[str] = None, **kwargs ): + """ + :keyword run_id: The unique identifier for the run. + :paramtype run_id: str + :keyword run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + "AutoBuild", "AutoRun". + :paramtype run_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunType + :keyword status: The current status of the run. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.RunStatus + :keyword create_time: The create time for a run. + :paramtype create_time: ~datetime.datetime + :keyword finish_time: The time the run finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_image_manifests: The list of comma-separated image manifests that were + generated from the run. This is applicable if the run is of + build type. + :paramtype output_image_manifests: str + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + :keyword task_name: The name of the task that the run corresponds to. + :paramtype task_name: str + """ super(RunFilter, self).__init__(**kwargs) self.run_id = run_id self.run_type = run_type @@ -1573,8 +2007,8 @@ def __init__( class RunGetLogResult(msrest.serialization.Model): """The result of get log link operation. - :param log_link: The link to logs for a run on a azure container registry. - :type log_link: str + :ivar log_link: The link to logs for a run on a azure container registry. + :vartype log_link: str """ _attribute_map = { @@ -1587,6 +2021,10 @@ def __init__( log_link: Optional[str] = None, **kwargs ): + """ + :keyword log_link: The link to logs for a run on a azure container registry. + :paramtype log_link: str + """ super(RunGetLogResult, self).__init__(**kwargs) self.log_link = log_link @@ -1594,10 +2032,10 @@ def __init__( class RunListResult(msrest.serialization.Model): """Collection of runs. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Run] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Run] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -1612,6 +2050,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Run] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(RunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1620,8 +2064,8 @@ def __init__( class RunUpdateParameters(msrest.serialization.Model): """The set of run properties that can be updated. - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool """ _attribute_map = { @@ -1634,6 +2078,10 @@ def __init__( is_archive_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + """ super(RunUpdateParameters, self).__init__(**kwargs) self.is_archive_enabled = is_archive_enabled @@ -1641,14 +2089,14 @@ def __init__( class SecretObject(msrest.serialization.Model): """Describes the properties of a secret object value. - :param value: The value of the secret. The format of this value will be determined + :ivar value: The value of the secret. The format of this value will be determined based on the type of the secret object. If the type is Opaque, the value will be used as is without any modification. - :type value: str - :param type: The type of the secret object which determines how the value of the secret object + :vartype value: str + :ivar type: The type of the secret object which determines how the value of the secret object has to be interpreted. Possible values include: "Opaque", "Vaultsecret". - :type type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObjectType + :vartype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObjectType """ _attribute_map = { @@ -1663,6 +2111,16 @@ def __init__( type: Optional[Union[str, "SecretObjectType"]] = None, **kwargs ): + """ + :keyword value: The value of the secret. The format of this value will be determined + based on the type of the secret object. If the type is Opaque, the value will be + used as is without any modification. + :paramtype value: str + :keyword type: The type of the secret object which determines how the value of the secret + object has to be + interpreted. Possible values include: "Opaque", "Vaultsecret". + :paramtype type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.SecretObjectType + """ super(SecretObject, self).__init__(**kwargs) self.value = value self.type = type @@ -1673,12 +2131,12 @@ class SetValue(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the overridable value. - :type name: str - :param value: Required. The overridable value. - :type value: str - :param is_secret: Flag to indicate whether the value represents a secret or not. - :type is_secret: bool + :ivar name: Required. The name of the overridable value. + :vartype name: str + :ivar value: Required. The overridable value. + :vartype value: str + :ivar is_secret: Flag to indicate whether the value represents a secret or not. + :vartype is_secret: bool """ _validation = { @@ -1700,6 +2158,14 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The name of the overridable value. + :paramtype name: str + :keyword value: Required. The overridable value. + :paramtype value: str + :keyword is_secret: Flag to indicate whether the value represents a secret or not. + :paramtype is_secret: bool + """ super(SetValue, self).__init__(**kwargs) self.name = name self.value = value @@ -1711,18 +2177,19 @@ class SourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_control_type: Required. The type of source control service. Possible values + :ivar source_control_type: Required. The type of source control service. Possible values include: "Github", "VisualStudioTeamService". - :type source_control_type: str or + :vartype source_control_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source + :ivar repository_url: Required. The full URL to the source code repository. + :vartype repository_url: str + :ivar branch: The branch name of the source code. + :vartype branch: str + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository and to set up webhooks for notifications. - :type source_control_auth_properties: ~azure.mgmt.containerregistry.v2019_04_01.models.AuthInfo + :vartype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2019_04_01.models.AuthInfo """ _validation = { @@ -1746,6 +2213,21 @@ def __init__( source_control_auth_properties: Optional["AuthInfo"] = None, **kwargs ): + """ + :keyword source_control_type: Required. The type of source control service. Possible values + include: "Github", "VisualStudioTeamService". + :paramtype source_control_type: str or + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceControlType + :keyword repository_url: Required. The full URL to the source code repository. + :paramtype repository_url: str + :keyword branch: The branch name of the source code. + :paramtype branch: str + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository and to set up + webhooks for notifications. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2019_04_01.models.AuthInfo + """ super(SourceProperties, self).__init__(**kwargs) self.source_control_type = source_control_type self.repository_url = repository_url @@ -1756,11 +2238,11 @@ def __init__( class SourceRegistryCredentials(msrest.serialization.Model): """Describes the credential parameters for accessing the source registry. - :param login_mode: The authentication mode which determines the source registry login scope. - The credentials for the source registry + :ivar login_mode: The authentication mode which determines the source registry login scope. The + credentials for the source registry will be generated using the given scope. These credentials will be used to login to the source registry during the run. Possible values include: "None", "Default". - :type login_mode: str or + :vartype login_mode: str or ~azure.mgmt.containerregistry.v2019_04_01.models.SourceRegistryLoginMode """ @@ -1774,6 +2256,14 @@ def __init__( login_mode: Optional[Union[str, "SourceRegistryLoginMode"]] = None, **kwargs ): + """ + :keyword login_mode: The authentication mode which determines the source registry login scope. + The credentials for the source registry + will be generated using the given scope. These credentials will be used to login to + the source registry during the run. Possible values include: "None", "Default". + :paramtype login_mode: str or + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceRegistryLoginMode + """ super(SourceRegistryCredentials, self).__init__(**kwargs) self.login_mode = login_mode @@ -1783,16 +2273,15 @@ class SourceTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_repository: Required. The properties that describes the source(code) for the - task. - :type source_repository: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceProperties - :param source_trigger_events: Required. The source event corresponding to the trigger. - :type source_trigger_events: list[str or + :ivar source_repository: Required. The properties that describes the source(code) for the task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceProperties + :ivar source_trigger_events: Required. The source event corresponding to the trigger. + :vartype source_trigger_events: list[str or ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -1817,6 +2306,18 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword source_repository: Required. The properties that describes the source(code) for the + task. + :paramtype source_repository: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceProperties + :keyword source_trigger_events: Required. The source event corresponding to the trigger. + :paramtype source_trigger_events: list[str or + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerEvent] + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(SourceTrigger, self).__init__(**kwargs) self.source_repository = source_repository self.source_trigger_events = source_trigger_events @@ -1827,20 +2328,20 @@ def __init__( class SourceTriggerDescriptor(msrest.serialization.Model): """The source trigger that caused a run. - :param id: The unique ID of the trigger. - :type id: str - :param event_type: The event type of the trigger. - :type event_type: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param pull_request_id: The unique ID that identifies pull request. - :type pull_request_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar event_type: The event type of the trigger. + :vartype event_type: str + :ivar commit_id: The unique ID that identifies a commit. + :vartype commit_id: str + :ivar pull_request_id: The unique ID that identifies pull request. + :vartype pull_request_id: str + :ivar repository_url: The repository URL. + :vartype repository_url: str + :ivar branch_name: The branch name in the repository. + :vartype branch_name: str + :ivar provider_type: The source control provider type. + :vartype provider_type: str """ _attribute_map = { @@ -1865,6 +2366,22 @@ def __init__( provider_type: Optional[str] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword event_type: The event type of the trigger. + :paramtype event_type: str + :keyword commit_id: The unique ID that identifies a commit. + :paramtype commit_id: str + :keyword pull_request_id: The unique ID that identifies pull request. + :paramtype pull_request_id: str + :keyword repository_url: The repository URL. + :paramtype repository_url: str + :keyword branch_name: The branch name in the repository. + :paramtype branch_name: str + :keyword provider_type: The source control provider type. + :paramtype provider_type: str + """ super(SourceTriggerDescriptor, self).__init__(**kwargs) self.id = id self.event_type = event_type @@ -1880,16 +2397,16 @@ class SourceTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_repository: The properties that describes the source(code) for the task. - :type source_repository: + :ivar source_repository: The properties that describes the source(code) for the task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2019_04_01.models.SourceUpdateParameters - :param source_trigger_events: The source event corresponding to the trigger. - :type source_trigger_events: list[str or + :ivar source_trigger_events: The source event corresponding to the trigger. + :vartype source_trigger_events: list[str or ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -1912,6 +2429,18 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword source_repository: The properties that describes the source(code) for the task. + :paramtype source_repository: + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceUpdateParameters + :keyword source_trigger_events: The source event corresponding to the trigger. + :paramtype source_trigger_events: list[str or + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerEvent] + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(SourceTriggerUpdateParameters, self).__init__(**kwargs) self.source_repository = source_repository self.source_trigger_events = source_trigger_events @@ -1922,18 +2451,18 @@ def __init__( class SourceUpdateParameters(msrest.serialization.Model): """The properties for updating the source code repository. - :param source_control_type: The type of source control service. Possible values include: + :ivar source_control_type: The type of source control service. Possible values include: "Github", "VisualStudioTeamService". - :type source_control_type: str or + :vartype source_control_type: str or ~azure.mgmt.containerregistry.v2019_04_01.models.SourceControlType - :param repository_url: The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source + :ivar repository_url: The full URL to the source code repository. + :vartype repository_url: str + :ivar branch: The branch name of the source code. + :vartype branch: str + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository and to set up webhooks for notifications. - :type source_control_auth_properties: + :vartype source_control_auth_properties: ~azure.mgmt.containerregistry.v2019_04_01.models.AuthInfoUpdateParameters """ @@ -1953,6 +2482,21 @@ def __init__( source_control_auth_properties: Optional["AuthInfoUpdateParameters"] = None, **kwargs ): + """ + :keyword source_control_type: The type of source control service. Possible values include: + "Github", "VisualStudioTeamService". + :paramtype source_control_type: str or + ~azure.mgmt.containerregistry.v2019_04_01.models.SourceControlType + :keyword repository_url: The full URL to the source code repository. + :paramtype repository_url: str + :keyword branch: The branch name of the source code. + :paramtype branch: str + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository and to set up + webhooks for notifications. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2019_04_01.models.AuthInfoUpdateParameters + """ super(SourceUpdateParameters, self).__init__(**kwargs) self.source_control_type = source_control_type self.repository_url = repository_url @@ -1963,11 +2507,11 @@ def __init__( class SourceUploadDefinition(msrest.serialization.Model): """The properties of a response to source upload request. - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent + :ivar upload_url: The URL where the client can upload the source. + :vartype upload_url: str + :ivar relative_path: The relative path to the source. This is used to submit the subsequent queue build request. - :type relative_path: str + :vartype relative_path: str """ _attribute_map = { @@ -1982,6 +2526,13 @@ def __init__( relative_path: Optional[str] = None, **kwargs ): + """ + :keyword upload_url: The URL where the client can upload the source. + :paramtype upload_url: str + :keyword relative_path: The relative path to the source. This is used to submit the subsequent + queue build request. + :paramtype relative_path: str + """ super(SourceUploadDefinition, self).__init__(**kwargs) self.upload_url = upload_url self.relative_path = relative_path @@ -2001,34 +2552,34 @@ class Task(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties :ivar provisioning_state: The provisioning state of the task. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_04_01.models.ProvisioningState :ivar creation_date: The creation date of task. :vartype creation_date: ~datetime.datetime - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties of a task step. - :type step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepProperties - :param trigger: The properties that describe all triggers for the task. - :type trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerProperties - :param credentials: The properties that describes a set of credentials that will be used when + :ivar status: The current status of task. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus + :ivar platform: The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar step: The properties of a task step. + :vartype step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepProperties + :ivar trigger: The properties that describe all triggers for the task. + :vartype trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerProperties + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials """ _validation = { @@ -2074,6 +2625,31 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties + :keyword status: The current status of task. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus + :keyword platform: The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword step: The properties of a task step. + :paramtype step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepProperties + :keyword trigger: The properties that describe all triggers for the task. + :paramtype trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerProperties + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + """ super(Task, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None @@ -2090,10 +2666,10 @@ def __init__( class TaskListResult(msrest.serialization.Model): """The collection of tasks. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Task] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Task] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -2108,6 +2684,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_04_01.models.Task] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(TaskListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2118,15 +2700,15 @@ class TaskRunRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param task_name: Required. The name of task against which run has to be queued. - :type task_name: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + :vartype is_archive_enabled: bool + :ivar task_name: Required. The name of task against which run has to be queued. + :vartype task_name: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] """ _validation = { @@ -2149,6 +2731,15 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword task_name: Required. The name of task against which run has to be queued. + :paramtype task_name: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_04_01.models.SetValue] + """ super(TaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, **kwargs) self.type = 'TaskRunRequest' # type: str self.task_name = task_name @@ -2158,25 +2749,25 @@ def __init__( class TaskUpdateParameters(msrest.serialization.Model): """The parameters for updating a task. - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformUpdateParameters - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties for updating a task step. - :type step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepUpdateParameters - :param trigger: The properties for updating trigger properties. - :type trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerUpdateParameters - :param credentials: The parameters that describes a set of credentials that will be used when + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties + :ivar tags: A set of tags. The ARM resource tags. + :vartype tags: dict[str, str] + :ivar status: The current status of task. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus + :ivar platform: The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformUpdateParameters + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar step: The properties for updating a task step. + :vartype step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepUpdateParameters + :ivar trigger: The properties for updating trigger properties. + :vartype trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerUpdateParameters + :ivar credentials: The parameters that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials """ _attribute_map = { @@ -2205,6 +2796,28 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.containerregistry.v2019_04_01.models.IdentityProperties + :keyword tags: A set of tags. The ARM resource tags. + :paramtype tags: dict[str, str] + :keyword status: The current status of task. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStatus + :keyword platform: The platform properties against which the run has to happen. + :paramtype platform: ~azure.mgmt.containerregistry.v2019_04_01.models.PlatformUpdateParameters + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_04_01.models.AgentProperties + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword step: The properties for updating a task step. + :paramtype step: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskStepUpdateParameters + :keyword trigger: The properties for updating trigger properties. + :paramtype trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerUpdateParameters + :keyword credentials: The parameters that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_04_01.models.Credentials + """ super(TaskUpdateParameters, self).__init__(**kwargs) self.identity = identity self.tags = tags @@ -2222,12 +2835,12 @@ class TimerTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param schedule: Required. The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar schedule: Required. The CRON expression for the task schedule. + :vartype schedule: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -2249,6 +2862,14 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword schedule: Required. The CRON expression for the task schedule. + :paramtype schedule: str + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(TimerTrigger, self).__init__(**kwargs) self.schedule = schedule self.status = status @@ -2258,10 +2879,10 @@ def __init__( class TimerTriggerDescriptor(msrest.serialization.Model): """TimerTriggerDescriptor. - :param timer_trigger_name: The timer trigger name that caused the run. - :type timer_trigger_name: str - :param schedule_occurrence: The occurrence that triggered the run. - :type schedule_occurrence: str + :ivar timer_trigger_name: The timer trigger name that caused the run. + :vartype timer_trigger_name: str + :ivar schedule_occurrence: The occurrence that triggered the run. + :vartype schedule_occurrence: str """ _attribute_map = { @@ -2276,6 +2897,12 @@ def __init__( schedule_occurrence: Optional[str] = None, **kwargs ): + """ + :keyword timer_trigger_name: The timer trigger name that caused the run. + :paramtype timer_trigger_name: str + :keyword schedule_occurrence: The occurrence that triggered the run. + :paramtype schedule_occurrence: str + """ super(TimerTriggerDescriptor, self).__init__(**kwargs) self.timer_trigger_name = timer_trigger_name self.schedule_occurrence = schedule_occurrence @@ -2286,12 +2913,12 @@ class TimerTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param schedule: The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar schedule: The CRON expression for the task schedule. + :vartype schedule: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -2312,6 +2939,14 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword schedule: The CRON expression for the task schedule. + :paramtype schedule: str + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_04_01.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(TimerTriggerUpdateParameters, self).__init__(**kwargs) self.schedule = schedule self.status = status @@ -2321,12 +2956,12 @@ def __init__( class TriggerProperties(msrest.serialization.Model): """The properties of a trigger. - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.TimerTrigger] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.SourceTrigger] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTrigger + :ivar timer_triggers: The collection of timer triggers. + :vartype timer_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.TimerTrigger] + :ivar source_triggers: The collection of triggers based on source code repository. + :vartype source_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.SourceTrigger] + :ivar base_image_trigger: The trigger based on base image dependencies. + :vartype base_image_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTrigger """ _attribute_map = { @@ -2343,6 +2978,16 @@ def __init__( base_image_trigger: Optional["BaseImageTrigger"] = None, **kwargs ): + """ + :keyword timer_triggers: The collection of timer triggers. + :paramtype timer_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.TimerTrigger] + :keyword source_triggers: The collection of triggers based on source code repository. + :paramtype source_triggers: + list[~azure.mgmt.containerregistry.v2019_04_01.models.SourceTrigger] + :keyword base_image_trigger: The trigger based on base image dependencies. + :paramtype base_image_trigger: + ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTrigger + """ super(TriggerProperties, self).__init__(**kwargs) self.timer_triggers = timer_triggers self.source_triggers = source_triggers @@ -2352,14 +2997,14 @@ def __init__( class TriggerUpdateParameters(msrest.serialization.Model): """The properties for updating triggers. - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: + :ivar timer_triggers: The collection of timer triggers. + :vartype timer_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.TimerTriggerUpdateParameters] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: + :ivar source_triggers: The collection of triggers based on source code repository. + :vartype source_triggers: list[~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerUpdateParameters] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: + :ivar base_image_trigger: The trigger based on base image dependencies. + :vartype base_image_trigger: ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerUpdateParameters """ @@ -2377,6 +3022,17 @@ def __init__( base_image_trigger: Optional["BaseImageTriggerUpdateParameters"] = None, **kwargs ): + """ + :keyword timer_triggers: The collection of timer triggers. + :paramtype timer_triggers: + list[~azure.mgmt.containerregistry.v2019_04_01.models.TimerTriggerUpdateParameters] + :keyword source_triggers: The collection of triggers based on source code repository. + :paramtype source_triggers: + list[~azure.mgmt.containerregistry.v2019_04_01.models.SourceTriggerUpdateParameters] + :keyword base_image_trigger: The trigger based on base image dependencies. + :paramtype base_image_trigger: + ~azure.mgmt.containerregistry.v2019_04_01.models.BaseImageTriggerUpdateParameters + """ super(TriggerUpdateParameters, self).__init__(**kwargs) self.timer_triggers = timer_triggers self.source_triggers = source_triggers @@ -2386,10 +3042,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -2404,6 +3060,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_registries_operations.py index 2f9bab633603..7c0dc7df937c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_registries_operations.py @@ -5,24 +5,106 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_schedule_run_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_build_source_upload_url_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -48,43 +130,32 @@ def __init__(self, client, config, serializer, deserializer): def _schedule_run_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_request, # type: "_models.RunRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Run"] + resource_group_name: str, + registry_name: str, + run_request: "_models.RunRequest", + **kwargs: Any + ) -> Optional["_models.Run"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Run"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._schedule_run_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_request, 'RunRequest') + + request = build_schedule_run_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._schedule_run_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_request, 'RunRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,16 +171,18 @@ def _schedule_run_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _schedule_run_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + + @distributed_trace def begin_schedule_run( self, - resource_group_name, # type: str - registry_name, # type: str - run_request, # type: "_models.RunRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Run"] + resource_group_name: str, + registry_name: str, + run_request: "_models.RunRequest", + **kwargs: Any + ) -> LROPoller["_models.Run"]: """Schedules a new run based on the request parameters and add it to the run queue. :param resource_group_name: The name of the resource group to which the container registry @@ -121,15 +194,18 @@ def begin_schedule_run( :type run_request: ~azure.mgmt.containerregistry.v2019_04_01.models.RunRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Run or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +217,21 @@ def begin_schedule_run( resource_group_name=resource_group_name, registry_name=registry_name, run_request=run_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,15 +243,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_schedule_run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + @distributed_trace def get_build_source_upload_url( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceUploadDefinition" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.SourceUploadDefinition": """Get the upload location for the user to be able to upload the source. :param resource_group_name: The name of the resource group to which the container registry @@ -199,27 +270,17 @@ def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,4 +294,6 @@ def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_runs_operations.py index 2c5555f9cfa8..c60a6659a6ae 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_runs_operations.py @@ -5,25 +5,221 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_log_sas_url_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_cancel_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class RunsOperations(object): """RunsOperations operations. @@ -47,15 +243,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.RunListResult"]: """Gets all the runs for a registry. :param resource_group_name: The name of the resource group to which the container registry @@ -72,7 +268,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.RunListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.RunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunListResult"] @@ -80,40 +277,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunListResult', pipeline_response) + deserialized = self._deserialize("RunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,19 +325,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Run" + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> "_models.Run": """Gets the detailed information for a given run. :param resource_group_name: The name of the resource group to which the container registry @@ -163,28 +358,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -198,49 +383,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - run_update_parameters, # type: "_models.RunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Run" + resource_group_name: str, + registry_name: str, + run_id: str, + run_update_parameters: "_models.RunUpdateParameters", + **kwargs: Any + ) -> "_models.Run": cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_update_parameters, 'RunUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_update_parameters, 'RunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -258,17 +434,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - run_update_parameters, # type: "_models.RunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Run"] + resource_group_name: str, + registry_name: str, + run_id: str, + run_update_parameters: "_models.RunUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Run"]: """Patch the run properties. :param resource_group_name: The name of the resource group to which the container registry @@ -279,18 +457,22 @@ def begin_update( :param run_id: The run ID. :type run_id: str :param run_update_parameters: The run update properties. - :type run_update_parameters: ~azure.mgmt.containerregistry.v2019_04_01.models.RunUpdateParameters + :type run_update_parameters: + ~azure.mgmt.containerregistry.v2019_04_01.models.RunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Run or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -303,28 +485,21 @@ def begin_update( registry_name=registry_name, run_id=run_id, run_update_parameters=run_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -336,16 +511,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + @distributed_trace def get_log_sas_url( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunGetLogResult" + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> "_models.RunGetLogResult": """Gets a link to download the run logs. :param resource_group_name: The name of the resource group to which the container registry @@ -365,28 +541,18 @@ def get_log_sas_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_log_sas_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_sas_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get_log_sas_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -400,41 +566,34 @@ def get_log_sas_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_sas_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl'} # type: ignore + def _cancel_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -447,14 +606,15 @@ def _cancel_initial( _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancel an existing run. :param resource_group_name: The name of the resource group to which the container registry @@ -466,15 +626,17 @@ def begin_cancel( :type run_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -489,22 +651,14 @@ def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -516,4 +670,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_tasks_operations.py index d2323a7e7186..dffb401ab76b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/operations/_tasks_operations.py @@ -5,25 +5,260 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_details_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TasksOperations(object): """TasksOperations operations. @@ -47,13 +282,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TaskListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TaskListResult"]: """Lists all the tasks for a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -63,7 +298,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.TaskListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_04_01.models.TaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskListResult"] @@ -71,36 +307,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TaskListResult', pipeline_response) + deserialized = self._deserialize("TaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +351,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> "_models.Task": """Get the properties of a specified task. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +384,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +409,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_create_parameters, # type: "_models.Task" - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + task_create_parameters: "_models.Task", + **kwargs: Any + ) -> "_models.Task": cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(task_create_parameters, 'Task') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_create_parameters, 'Task') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +460,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_create_parameters, # type: "_models.Task" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Task"] + resource_group_name: str, + registry_name: str, + task_name: str, + task_create_parameters: "_models.Task", + **kwargs: Any + ) -> LROPoller["_models.Task"]: """Creates a task for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -269,15 +486,18 @@ def begin_create( :type task_create_parameters: ~azure.mgmt.containerregistry.v2019_04_01.models.Task :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Task or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +510,21 @@ def begin_create( registry_name=registry_name, task_name=task_name, task_create_parameters=task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +536,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +575,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified task. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +595,17 @@ def begin_delete( :type task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +620,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,49 +639,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_update_parameters, # type: "_models.TaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + task_update_parameters: "_models.TaskUpdateParameters", + **kwargs: Any + ) -> "_models.Task": cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,17 +689,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_update_parameters, # type: "_models.TaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Task"] + resource_group_name: str, + registry_name: str, + task_name: str, + task_update_parameters: "_models.TaskUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Task"]: """Updates a task with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -520,18 +712,22 @@ def begin_update( :param task_name: The name of the container registry task. :type task_name: str :param task_update_parameters: The parameters for updating a task. - :type task_update_parameters: ~azure.mgmt.containerregistry.v2019_04_01.models.TaskUpdateParameters + :type task_update_parameters: + ~azure.mgmt.containerregistry.v2019_04_01.models.TaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Task or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_04_01.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -544,28 +740,21 @@ def begin_update( registry_name=registry_name, task_name=task_name, task_update_parameters=task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -577,16 +766,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + @distributed_trace def get_details( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> "_models.Task": """Returns a task with extended information that includes all secrets. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +796,18 @@ def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-04-01" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,4 +821,6 @@ def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_configuration.py index 49ce39deb89e..c8e22a0c1de8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_container_registry_management_client.py index 6d4ba982407d..3f5a7331dbdf 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_container_registry_management_client.py @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import Operations -from .operations import ReplicationsOperations -from .operations import WebhooksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations @@ -34,61 +29,65 @@ class ContainerRegistryManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2019_05_01.operations.Operations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2019_05_01.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2019_05_01.operations.ReplicationsOperations :ivar webhooks: WebhooksOperations operations :vartype webhooks: azure.mgmt.containerregistry.v2019_05_01.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_metadata.json index 29587c1a4e75..ccb458b9785a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "registries": "RegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_configuration.py index 0bfcfeb70a78..5f92b9a0f092 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_container_registry_management_client.py index a7130543cbb1..fbea1395cac0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_container_registry_management_client.py @@ -6,85 +6,89 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import RegistriesOperations -from .operations import Operations -from .operations import ReplicationsOperations -from .operations import WebhooksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_05_01.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_05_01.aio.operations.RegistriesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2019_05_01.aio.operations.Operations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2019_05_01.aio.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2019_05_01.aio.operations.ReplicationsOperations :ivar webhooks: WebhooksOperations operations :vartype webhooks: azure.mgmt.containerregistry.v2019_05_01.aio.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_operations.py index 8723f35e8107..6cffab5f7eee 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_registries_operations.py index 110ceed42882..9d913e880f6b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_get_request, build_import_image_request_initial, build_list_by_resource_group_request, build_list_credentials_request, build_list_request, build_list_usages_request, build_regenerate_credential_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,30 +60,22 @@ async def _import_image_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -91,6 +88,8 @@ async def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace_async async def begin_import_image( self, resource_group_name: str, @@ -110,15 +109,18 @@ async def begin_import_image( :type parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -130,24 +132,18 @@ async def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -159,8 +155,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace_async async def check_name_availability( self, registry_name_check_request: "_models.RegistryNameCheckRequest", @@ -171,7 +169,8 @@ async def check_name_availability( :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryNameStatus @@ -182,30 +181,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,8 +208,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -244,27 +236,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,8 +260,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -292,32 +276,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -335,8 +309,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -355,15 +332,20 @@ async def begin_create( :type registry: ~azure.mgmt.containerregistry.v2019_05_01.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -375,27 +357,21 @@ async def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,6 +383,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _delete_initial( @@ -420,25 +397,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -451,6 +420,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -466,15 +437,17 @@ async def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -488,21 +461,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,6 +480,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _update_initial( @@ -528,32 +495,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -571,8 +528,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -588,18 +548,24 @@ async def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -611,27 +577,21 @@ async def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -643,8 +603,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -657,7 +619,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -665,35 +628,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -711,11 +670,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -724,7 +685,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -732,34 +694,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -777,11 +734,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace_async async def list_credentials( self, resource_group_name: str, @@ -805,27 +764,17 @@ async def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,8 +788,11 @@ async def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace_async async def regenerate_credential( self, resource_group_name: str, @@ -857,7 +809,8 @@ async def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListCredentialsResult @@ -868,32 +821,22 @@ async def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -907,8 +850,11 @@ async def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace_async async def list_usages( self, resource_group_name: str, @@ -932,27 +878,17 @@ async def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -966,4 +902,6 @@ async def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_replications_operations.py index 5b731bf27fa5..0aec33110d02 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_replications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._replications_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,20 @@ async def begin_create( :type replication: ~azure.mgmt.containerregistry.v2019_05_01.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +203,21 @@ async def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +229,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _delete_initial( @@ -254,26 +244,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +268,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +288,17 @@ async def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +313,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +332,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _update_initial( @@ -369,33 +348,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +382,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +405,24 @@ async def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +435,21 @@ async def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -506,8 +479,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_webhooks_operations.py index 17c32607e651..a1e4b3c7ab89 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/aio/operations/_webhooks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._webhooks_operations import build_create_request_initial, build_delete_request_initial, build_get_callback_config_request, build_get_request, build_list_events_request, build_list_request, build_ping_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.WebhookListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace_async async def ping( self, resource_group_name: str, @@ -593,28 +567,18 @@ async def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +592,11 @@ async def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace_async async def get_callback_config( self, resource_group_name: str, @@ -656,28 +623,18 @@ async def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -691,8 +648,11 @@ async def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, resource_group_name: str, @@ -711,7 +671,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.EventListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -719,37 +680,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -767,6 +726,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/__init__.py index 80ced1412125..9cfbb0bab4c1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/__init__.py @@ -6,102 +6,54 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Actor - from ._models_py3 import CallbackConfig - from ._models_py3 import Event - from ._models_py3 import EventContent - from ._models_py3 import EventInfo - from ._models_py3 import EventListResult - from ._models_py3 import EventRequestMessage - from ._models_py3 import EventResponseMessage - from ._models_py3 import IPRule - from ._models_py3 import ImportImageParameters - from ._models_py3 import ImportSource - from ._models_py3 import ImportSourceCredentials - from ._models_py3 import NetworkRuleSet - from ._models_py3 import OperationDefinition - from ._models_py3 import OperationDisplayDefinition - from ._models_py3 import OperationListResult - from ._models_py3 import OperationMetricSpecificationDefinition - from ._models_py3 import OperationServiceSpecificationDefinition - from ._models_py3 import Policies - from ._models_py3 import QuarantinePolicy - from ._models_py3 import RegenerateCredentialParameters - from ._models_py3 import Registry - from ._models_py3 import RegistryListCredentialsResult - from ._models_py3 import RegistryListResult - from ._models_py3 import RegistryNameCheckRequest - from ._models_py3 import RegistryNameStatus - from ._models_py3 import RegistryPassword - from ._models_py3 import RegistryUpdateParameters - from ._models_py3 import RegistryUsage - from ._models_py3 import RegistryUsageListResult - from ._models_py3 import Replication - from ._models_py3 import ReplicationListResult - from ._models_py3 import ReplicationUpdateParameters - from ._models_py3 import Request - from ._models_py3 import Resource - from ._models_py3 import RetentionPolicy - from ._models_py3 import Sku - from ._models_py3 import Source - from ._models_py3 import Status - from ._models_py3 import StorageAccountProperties - from ._models_py3 import Target - from ._models_py3 import TrustPolicy - from ._models_py3 import VirtualNetworkRule - from ._models_py3 import Webhook - from ._models_py3 import WebhookCreateParameters - from ._models_py3 import WebhookListResult - from ._models_py3 import WebhookUpdateParameters -except (SyntaxError, ImportError): - from ._models import Actor # type: ignore - from ._models import CallbackConfig # type: ignore - from ._models import Event # type: ignore - from ._models import EventContent # type: ignore - from ._models import EventInfo # type: ignore - from ._models import EventListResult # type: ignore - from ._models import EventRequestMessage # type: ignore - from ._models import EventResponseMessage # type: ignore - from ._models import IPRule # type: ignore - from ._models import ImportImageParameters # type: ignore - from ._models import ImportSource # type: ignore - from ._models import ImportSourceCredentials # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import OperationDefinition # type: ignore - from ._models import OperationDisplayDefinition # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationMetricSpecificationDefinition # type: ignore - from ._models import OperationServiceSpecificationDefinition # type: ignore - from ._models import Policies # type: ignore - from ._models import QuarantinePolicy # type: ignore - from ._models import RegenerateCredentialParameters # type: ignore - from ._models import Registry # type: ignore - from ._models import RegistryListCredentialsResult # type: ignore - from ._models import RegistryListResult # type: ignore - from ._models import RegistryNameCheckRequest # type: ignore - from ._models import RegistryNameStatus # type: ignore - from ._models import RegistryPassword # type: ignore - from ._models import RegistryUpdateParameters # type: ignore - from ._models import RegistryUsage # type: ignore - from ._models import RegistryUsageListResult # type: ignore - from ._models import Replication # type: ignore - from ._models import ReplicationListResult # type: ignore - from ._models import ReplicationUpdateParameters # type: ignore - from ._models import Request # type: ignore - from ._models import Resource # type: ignore - from ._models import RetentionPolicy # type: ignore - from ._models import Sku # type: ignore - from ._models import Source # type: ignore - from ._models import Status # type: ignore - from ._models import StorageAccountProperties # type: ignore - from ._models import Target # type: ignore - from ._models import TrustPolicy # type: ignore - from ._models import VirtualNetworkRule # type: ignore - from ._models import Webhook # type: ignore - from ._models import WebhookCreateParameters # type: ignore - from ._models import WebhookListResult # type: ignore - from ._models import WebhookUpdateParameters # type: ignore +from ._models_py3 import Actor +from ._models_py3 import CallbackConfig +from ._models_py3 import Event +from ._models_py3 import EventContent +from ._models_py3 import EventInfo +from ._models_py3 import EventListResult +from ._models_py3 import EventRequestMessage +from ._models_py3 import EventResponseMessage +from ._models_py3 import IPRule +from ._models_py3 import ImportImageParameters +from ._models_py3 import ImportSource +from ._models_py3 import ImportSourceCredentials +from ._models_py3 import NetworkRuleSet +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import OperationMetricSpecificationDefinition +from ._models_py3 import OperationServiceSpecificationDefinition +from ._models_py3 import Policies +from ._models_py3 import QuarantinePolicy +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import RegistryUsage +from ._models_py3 import RegistryUsageListResult +from ._models_py3 import Replication +from ._models_py3 import ReplicationListResult +from ._models_py3 import ReplicationUpdateParameters +from ._models_py3 import Request +from ._models_py3 import Resource +from ._models_py3 import RetentionPolicy +from ._models_py3 import Sku +from ._models_py3 import Source +from ._models_py3 import Status +from ._models_py3 import StorageAccountProperties +from ._models_py3 import Target +from ._models_py3 import TrustPolicy +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import Webhook +from ._models_py3 import WebhookCreateParameters +from ._models_py3 import WebhookListResult +from ._models_py3 import WebhookUpdateParameters + from ._container_registry_management_client_enums import ( Action, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_container_registry_management_client_enums.py index a0f2407c640c..58c12bf3e36f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_container_registry_management_client_enums.py @@ -6,40 +6,25 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Action(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action of virtual network rule. """ ALLOW = "Allow" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImportMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. """ @@ -47,21 +32,21 @@ class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NO_FORCE = "NoForce" FORCE = "Force" -class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name. """ PASSWORD = "password" PASSWORD2 = "password2" -class PolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the container registry at the time the operation was called. """ @@ -72,14 +57,14 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class RegistryUsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegistryUsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement. """ COUNT = "Count" BYTES = "Bytes" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name of the container registry. Required for registry creation. """ @@ -88,7 +73,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier based on the SKU name. """ @@ -97,13 +82,13 @@ class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TrustPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrustPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of trust policy. """ NOTARY = "Notary" -class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PUSH = "push" DELETE = "delete" @@ -111,7 +96,7 @@ class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CHART_PUSH = "chart_push" CHART_DELETE = "chart_delete" -class WebhookStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the webhook at the time the operation was called. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py deleted file mode 100644 index 47589e18da9f..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py +++ /dev/null @@ -1,1569 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Actor(msrest.serialization.Model): - """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - - :param name: The subject or username associated with the request context that generated the - event. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Actor, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class CallbackConfig(msrest.serialization.Model): - """The configuration of service URI and custom headers for the webhook. - - All required parameters must be populated in order to send to Azure. - - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - """ - - _validation = { - 'service_uri': {'required': True}, - } - - _attribute_map = { - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(CallbackConfig, self).__init__(**kwargs) - self.service_uri = kwargs['service_uri'] - self.custom_headers = kwargs.get('custom_headers', None) - - -class EventInfo(msrest.serialization.Model): - """The basic information of an event. - - :param id: The event ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventInfo, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Event(EventInfo): - """The event for a webhook. - - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: - ~azure.mgmt.containerregistry.v2019_05_01.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: - ~azure.mgmt.containerregistry.v2019_05_01.models.EventResponseMessage - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, - 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.event_request_message = kwargs.get('event_request_message', None) - self.event_response_message = kwargs.get('event_response_message', None) - - -class EventContent(msrest.serialization.Model): - """The content of the event request message. - - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2019_05_01.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2019_05_01.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the - authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2019_05_01.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor - initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2019_05_01.models.Source - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'action': {'key': 'action', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'Target'}, - 'request': {'key': 'request', 'type': 'Request'}, - 'actor': {'key': 'actor', 'type': 'Actor'}, - 'source': {'key': 'source', 'type': 'Source'}, - } - - def __init__( - self, - **kwargs - ): - super(EventContent, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.action = kwargs.get('action', None) - self.target = kwargs.get('target', None) - self.request = kwargs.get('request', None) - self.actor = kwargs.get('actor', None) - self.source = kwargs.get('source', None) - - -class EventListResult(msrest.serialization.Model): - """The result of a request to list events for a webhook. - - :param value: The list of events. Since this list may be incomplete, the nextLink field should - be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventRequestMessage(msrest.serialization.Model): - """The event request message sent to the service URI. - - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2019_05_01.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'EventContent'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'method': {'key': 'method', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventRequestMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.method = kwargs.get('method', None) - self.request_uri = kwargs.get('request_uri', None) - self.version = kwargs.get('version', None) - - -class EventResponseMessage(msrest.serialization.Model): - """The event response message received from the service URI. - - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventResponseMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.reason_phrase = kwargs.get('reason_phrase', None) - self.status_code = kwargs.get('status_code', None) - self.version = kwargs.get('version', None) - - -class ImportImageParameters(msrest.serialization.Model): - """ImportImageParameters. - - All required parameters must be populated in order to send to Azure. - - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will - be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only - copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any - existing target tags will fail the operation before any copying begins. Possible values - include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2019_05_01.models.ImportMode - """ - - _validation = { - 'source': {'required': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'ImportSource'}, - 'target_tags': {'key': 'targetTags', 'type': '[str]'}, - 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportImageParameters, self).__init__(**kwargs) - self.source = kwargs['source'] - self.target_tags = kwargs.get('target_tags', None) - self.untagged_target_repositories = kwargs.get('untagged_target_repositories', None) - self.mode = kwargs.get('mode', "NoForce") - - -class ImportSource(msrest.serialization.Model): - """ImportSource. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str - """ - - _validation = { - 'source_image': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'registry_uri': {'key': 'registryUri', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, - 'source_image': {'key': 'sourceImage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSource, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.registry_uri = kwargs.get('registry_uri', None) - self.credentials = kwargs.get('credentials', None) - self.source_image = kwargs['source_image'] - - -class ImportSourceCredentials(msrest.serialization.Model): - """ImportSourceCredentials. - - All required parameters must be populated in order to send to Azure. - - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str - """ - - _validation = { - 'password': {'required': True}, - } - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSourceCredentials, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs['password'] - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.ip_address_or_range = kwargs['ip_address_or_range'] - - -class NetworkRuleSet(msrest.serialization.Model): - """The network rule set for a container registry. - - All required parameters must be populated in order to send to Azure. - - :param default_action: Required. The default action of allow or deny when no other rules match. - Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.containerregistry.v2019_05_01.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2019_05_01.models.IPRule] - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', "Allow") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - - -class OperationDefinition(msrest.serialization.Model): - """The definition of a container registry operation. - - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: ~azure.mgmt.containerregistry.v2019_05_01.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: - ~azure.mgmt.containerregistry.v2019_05_01.models.OperationServiceSpecificationDefinition - """ - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDefinition, self).__init__(**kwargs) - self.origin = kwargs.get('origin', None) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplayDefinition(msrest.serialization.Model): - """The display information for a container registry operation. - - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The result of a request to list container registry operations. - - :param value: The list of container registry operations. Since this list may be incomplete, the - nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry - operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationMetricSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring metric. - - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class OperationServiceSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring list. - - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: - list[~azure.mgmt.containerregistry.v2019_05_01.models.OperationMetricSpecificationDefinition] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Policies(msrest.serialization.Model): - """The policies for a container registry. - - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.RetentionPolicy - """ - - _attribute_map = { - 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, - 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(Policies, self).__init__(**kwargs) - self.quarantine_policy = kwargs.get('quarantine_policy', None) - self.trust_policy = kwargs.get('trust_policy', None) - self.retention_policy = kwargs.get('retention_policy', None) - - -class QuarantinePolicy(msrest.serialization.Model): - """The quarantine policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuarantinePolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - - -class RegenerateCredentialParameters(msrest.serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateCredentialParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class Registry(Resource): - """An object that represents a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku - :ivar login_server: The URL that can be used to log into the container registry. - :vartype login_server: str - :ivar creation_date: The creation date of the container registry in ISO8601 format. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the container registry at the time the - operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", - "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_05_01.models.ProvisioningState - :ivar status: The status of the container registry at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2019_05_01.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The properties of the storage account for the container registry. Only - applicable to Classic SKU. - :type storage_account: - ~azure.mgmt.containerregistry.v2019_05_01.models.StorageAccountProperties - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'login_server': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountProperties'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - } - - def __init__( - self, - **kwargs - ): - super(Registry, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.login_server = None - self.creation_date = None - self.provisioning_state = None - self.status = None - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.storage_account = kwargs.get('storage_account', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - - -class RegistryListCredentialsResult(msrest.serialization.Model): - """The response from the ListCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class RegistryListResult(msrest.serialization.Model): - """The result of a request to list container registries. - - :param value: The list of container registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Registry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegistryNameCheckRequest(msrest.serialization.Model): - """A request to check whether a container registry name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the container registry. - :type name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Has constant value: - "Microsoft.ContainerRegistry/registries". - :vartype type: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - **kwargs - ): - super(RegistryNameCheckRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class RegistryNameStatus(msrest.serialization.Model): - """The result of a request to check the availability of a container registry name. - - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryNameStatus, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class RegistryPassword(msrest.serialization.Model): - """The login password for the container registry. - - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName - :param value: The password value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPassword, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class RegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a container registry. - - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.admin_user_enabled = kwargs.get('admin_user_enabled', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - - -class RegistryUsage(msrest.serialization.Model): - """The quota usage for a container registry. - - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsageUnit - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsage, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.limit = kwargs.get('limit', None) - self.current_value = kwargs.get('current_value', None) - self.unit = kwargs.get('unit', None) - - -class RegistryUsageListResult(msrest.serialization.Model): - """The result of a request to get container registry quota usages. - - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RegistryUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Replication(Resource): - """An object that represents a replication for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: The provisioning state of the replication at the time the operation - was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_05_01.models.ProvisioningState - :ivar status: The status of the replication at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2019_05_01.models.Status - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - } - - def __init__( - self, - **kwargs - ): - super(Replication, self).__init__(**kwargs) - self.provisioning_state = None - self.status = None - - -class ReplicationListResult(msrest.serialization.Model): - """The result of a request to list replications for a container registry. - - :param value: The list of replications. Since this list may be incomplete, the nextLink field - should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Replication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationUpdateParameters(msrest.serialization.Model): - """The parameters for updating a replication. - - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Request(msrest.serialization.Model): - """The request that generated the event. - - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the - event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the - http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'addr': {'key': 'addr', 'type': 'str'}, - 'host': {'key': 'host', 'type': 'str'}, - 'method': {'key': 'method', 'type': 'str'}, - 'useragent': {'key': 'useragent', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.addr = kwargs.get('addr', None) - self.host = kwargs.get('host', None) - self.method = kwargs.get('method', None) - self.useragent = kwargs.get('useragent', None) - - -class RetentionPolicy(msrest.serialization.Model): - """The retention policy for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int - :ivar last_updated_time: The timestamp when the policy was last updated. - :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus - """ - - _validation = { - 'last_updated_time': {'readonly': True}, - } - - _attribute_map = { - 'days': {'key': 'days', 'type': 'int'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RetentionPolicy, self).__init__(**kwargs) - self.days = kwargs.get('days', 7) - self.last_updated_time = None - self.status = kwargs.get('status', None) - - -class Sku(msrest.serialization.Model): - """The SKU of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name of the container registry. Required for registry creation. - Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.SkuName - :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.containerregistry.v2019_05_01.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class Source(msrest.serialization.Model): - """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - - :param addr: The IP or hostname and the port of the registry node that generated the event. - Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str - """ - - _attribute_map = { - 'addr': {'key': 'addr', 'type': 'str'}, - 'instance_id': {'key': 'instanceID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Source, self).__init__(**kwargs) - self.addr = kwargs.get('addr', None) - self.instance_id = kwargs.get('instance_id', None) - - -class Status(msrest.serialization.Model): - """The status of an Azure resource at the time the operation was called. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_status: The short label for the status. - :vartype display_status: str - :ivar message: The detailed message for the status, including alerts and error messages. - :vartype message: str - :ivar timestamp: The timestamp when the status was changed to the current value. - :vartype timestamp: ~datetime.datetime - """ - - _validation = { - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'timestamp': {'readonly': True}, - } - - _attribute_map = { - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Status, self).__init__(**kwargs) - self.display_status = None - self.message = None - self.timestamp = None - - -class StorageAccountProperties(msrest.serialization.Model): - """The properties of a storage account for a container registry. Only applicable to Classic SKU. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The resource ID of the storage account. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountProperties, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class Target(msrest.serialization.Model): - """The target of the event. - - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str - """ - - _attribute_map = { - 'media_type': {'key': 'mediaType', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'long'}, - 'digest': {'key': 'digest', 'type': 'str'}, - 'length': {'key': 'length', 'type': 'long'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Target, self).__init__(**kwargs) - self.media_type = kwargs.get('media_type', None) - self.size = kwargs.get('size', None) - self.digest = kwargs.get('digest', None) - self.length = kwargs.get('length', None) - self.repository = kwargs.get('repository', None) - self.url = kwargs.get('url', None) - self.tag = kwargs.get('tag', None) - self.name = kwargs.get('name', None) - self.version = kwargs.get('version', None) - - -class TrustPolicy(msrest.serialization.Model): - """The content trust policy for a container registry. - - :param type: The type of trust policy. Possible values include: "Notary". Default value: - "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustPolicy, self).__init__(**kwargs) - self.type = kwargs.get('type', "Notary") - self.status = kwargs.get('status', None) - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual network rule. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - - -class Webhook(Resource): - """An object that represents a webhook for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] - :ivar provisioning_state: The provisioning state of the webhook at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_05_01.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Webhook, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - self.provisioning_state = None - - -class WebhookCreateParameters(msrest.serialization.Model): - """The parameters for creating a webhook. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the - resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - - -class WebhookListResult(msrest.serialization.Model): - """The result of a request to list webhooks for a container registry. - - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Webhook]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WebhookUpdateParameters(msrest.serialization.Model): - """The parameters for updating a webhook. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py index 3be2a3280335..0d0d795a664c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py @@ -17,9 +17,9 @@ class Actor(msrest.serialization.Model): """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :param name: The subject or username associated with the request context that generated the + :ivar name: The subject or username associated with the request context that generated the event. - :type name: str + :vartype name: str """ _attribute_map = { @@ -32,6 +32,11 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The subject or username associated with the request context that generated the + event. + :paramtype name: str + """ super(Actor, self).__init__(**kwargs) self.name = name @@ -41,10 +46,10 @@ class CallbackConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] + :ivar service_uri: Required. The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] """ _validation = { @@ -63,6 +68,12 @@ def __init__( custom_headers: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword service_uri: Required. The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + """ super(CallbackConfig, self).__init__(**kwargs) self.service_uri = service_uri self.custom_headers = custom_headers @@ -71,8 +82,8 @@ def __init__( class EventInfo(msrest.serialization.Model): """The basic information of an event. - :param id: The event ID. - :type id: str + :ivar id: The event ID. + :vartype id: str """ _attribute_map = { @@ -85,6 +96,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + """ super(EventInfo, self).__init__(**kwargs) self.id = id @@ -92,13 +107,13 @@ def __init__( class Event(EventInfo): """The event for a webhook. - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: + :ivar id: The event ID. + :vartype id: str + :ivar event_request_message: The event request message sent to the service URI. + :vartype event_request_message: ~azure.mgmt.containerregistry.v2019_05_01.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: ~azure.mgmt.containerregistry.v2019_05_01.models.EventResponseMessage """ @@ -116,6 +131,16 @@ def __init__( event_response_message: Optional["EventResponseMessage"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword event_request_message: The event request message sent to the service URI. + :paramtype event_request_message: + ~azure.mgmt.containerregistry.v2019_05_01.models.EventRequestMessage + :keyword event_response_message: The event response message received from the service URI. + :paramtype event_response_message: + ~azure.mgmt.containerregistry.v2019_05_01.models.EventResponseMessage + """ super(Event, self).__init__(id=id, **kwargs) self.event_request_message = event_request_message self.event_response_message = event_response_message @@ -124,22 +149,22 @@ def __init__( class EventContent(msrest.serialization.Model): """The content of the event request message. - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2019_05_01.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2019_05_01.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar target: The target of the event. + :vartype target: ~azure.mgmt.containerregistry.v2019_05_01.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.v2019_05_01.models.Request + :ivar actor: The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2019_05_01.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor + :vartype actor: ~azure.mgmt.containerregistry.v2019_05_01.models.Actor + :ivar source: The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2019_05_01.models.Source + :vartype source: ~azure.mgmt.containerregistry.v2019_05_01.models.Source """ _attribute_map = { @@ -164,6 +189,24 @@ def __init__( source: Optional["Source"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword timestamp: The time at which the event occurred. + :paramtype timestamp: ~datetime.datetime + :keyword action: The action that encompasses the provided event. + :paramtype action: str + :keyword target: The target of the event. + :paramtype target: ~azure.mgmt.containerregistry.v2019_05_01.models.Target + :keyword request: The request that generated the event. + :paramtype request: ~azure.mgmt.containerregistry.v2019_05_01.models.Request + :keyword actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :paramtype actor: ~azure.mgmt.containerregistry.v2019_05_01.models.Actor + :keyword source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :paramtype source: ~azure.mgmt.containerregistry.v2019_05_01.models.Source + """ super(EventContent, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -177,11 +220,11 @@ def __init__( class EventListResult(msrest.serialization.Model): """The result of a request to list events for a webhook. - :param value: The list of events. Since this list may be incomplete, the nextLink field should + :ivar value: The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Event] + :ivar next_link: The URI that can be used to request the next list of events. + :vartype next_link: str """ _attribute_map = { @@ -196,6 +239,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of events. Since this list may be incomplete, the nextLink field + should be used to request the next list of events. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Event] + :keyword next_link: The URI that can be used to request the next list of events. + :paramtype next_link: str + """ super(EventListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -204,16 +254,16 @@ def __init__( class EventRequestMessage(msrest.serialization.Model): """The event request message sent to the service URI. - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2019_05_01.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.v2019_05_01.models.EventContent + :ivar headers: The headers of the event request message. + :vartype headers: dict[str, str] + :ivar method: The HTTP method used to send the event request message. + :vartype method: str + :ivar request_uri: The URI used to send the event request message. + :vartype request_uri: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -234,6 +284,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event request message. + :paramtype content: ~azure.mgmt.containerregistry.v2019_05_01.models.EventContent + :keyword headers: The headers of the event request message. + :paramtype headers: dict[str, str] + :keyword method: The HTTP method used to send the event request message. + :paramtype method: str + :keyword request_uri: The URI used to send the event request message. + :paramtype request_uri: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventRequestMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -245,16 +307,16 @@ def __init__( class EventResponseMessage(msrest.serialization.Model): """The event response message received from the service URI. - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event response message. + :vartype content: str + :ivar headers: The headers of the event response message. + :vartype headers: dict[str, str] + :ivar reason_phrase: The reason phrase of the event response message. + :vartype reason_phrase: str + :ivar status_code: The status code of the event response message. + :vartype status_code: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -275,6 +337,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event response message. + :paramtype content: str + :keyword headers: The headers of the event response message. + :paramtype headers: dict[str, str] + :keyword reason_phrase: The reason phrase of the event response message. + :paramtype reason_phrase: str + :keyword status_code: The status code of the event response message. + :paramtype status_code: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventResponseMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -288,18 +362,18 @@ class ImportImageParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + :ivar source: Required. The source of the image. + :vartype source: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSource + :ivar target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only + :vartype target_tags: list[str] + :ivar untagged_target_repositories: List of strings of repository names to do a manifest only copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + :vartype untagged_target_repositories: list[str] + :ivar mode: When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2019_05_01.models.ImportMode + :vartype mode: str or ~azure.mgmt.containerregistry.v2019_05_01.models.ImportMode """ _validation = { @@ -322,6 +396,20 @@ def __init__( mode: Optional[Union[str, "ImportMode"]] = "NoForce", **kwargs ): + """ + :keyword source: Required. The source of the image. + :paramtype source: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSource + :keyword target_tags: List of strings of the form repo[:tag]. When tag is omitted the source + will be used (or 'latest' if source tag is also omitted). + :paramtype target_tags: list[str] + :keyword untagged_target_repositories: List of strings of repository names to do a manifest + only copy. No tag will be created. + :paramtype untagged_target_repositories: list[str] + :keyword mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :paramtype mode: str or ~azure.mgmt.containerregistry.v2019_05_01.models.ImportMode + """ super(ImportImageParameters, self).__init__(**kwargs) self.source = source self.target_tags = target_tags @@ -334,17 +422,17 @@ class ImportSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. + :ivar resource_id: The resource identifier of the source Azure Container Registry. + :vartype resource_id: str + :ivar registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :vartype registry_uri: str + :ivar credentials: Credentials used when importing from a registry uri. + :vartype credentials: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSourceCredentials + :ivar source_image: Required. Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str + :vartype source_image: str """ _validation = { @@ -367,6 +455,20 @@ def __init__( credentials: Optional["ImportSourceCredentials"] = None, **kwargs ): + """ + :keyword resource_id: The resource identifier of the source Azure Container Registry. + :paramtype resource_id: str + :keyword registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :paramtype registry_uri: str + :keyword credentials: Credentials used when importing from a registry uri. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2019_05_01.models.ImportSourceCredentials + :keyword source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype source_image: str + """ super(ImportSource, self).__init__(**kwargs) self.resource_id = resource_id self.registry_uri = registry_uri @@ -379,10 +481,10 @@ class ImportSourceCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: Required. The password used to authenticate with the source registry. + :vartype password: str """ _validation = { @@ -401,6 +503,12 @@ def __init__( username: Optional[str] = None, **kwargs ): + """ + :keyword username: The username to authenticate with the source registry. + :paramtype username: str + :keyword password: Required. The password used to authenticate with the source registry. + :paramtype password: str + """ super(ImportSourceCredentials, self).__init__(**kwargs) self.username = username self.password = password @@ -411,11 +519,11 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar action: The action of IP ACL rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str + :vartype ip_address_or_range: str """ _validation = { @@ -434,6 +542,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of IP ACL rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + """ super(IPRule, self).__init__(**kwargs) self.action = action self.ip_address_or_range = ip_address_or_range @@ -444,14 +559,14 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param default_action: Required. The default action of allow or deny when no other rules match. + :ivar default_action: Required. The default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: + :vartype default_action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.DefaultAction + :ivar virtual_network_rules: The virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.containerregistry.v2019_05_01.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2019_05_01.models.IPRule] + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.v2019_05_01.models.IPRule] """ _validation = { @@ -472,6 +587,17 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword default_action: Required. The default action of allow or deny when no other rules + match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or + ~azure.mgmt.containerregistry.v2019_05_01.models.DefaultAction + :keyword virtual_network_rules: The virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.containerregistry.v2019_05_01.models.VirtualNetworkRule] + :keyword ip_rules: The IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.containerregistry.v2019_05_01.models.IPRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules @@ -481,14 +607,14 @@ def __init__( class OperationDefinition(msrest.serialization.Model): """The definition of a container registry operation. - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: ~azure.mgmt.containerregistry.v2019_05_01.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: + :ivar origin: The origin information of the container registry operation. + :vartype origin: str + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2019_05_01.models.OperationDisplayDefinition + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: ~azure.mgmt.containerregistry.v2019_05_01.models.OperationServiceSpecificationDefinition """ @@ -508,6 +634,17 @@ def __init__( service_specification: Optional["OperationServiceSpecificationDefinition"] = None, **kwargs ): + """ + :keyword origin: The origin information of the container registry operation. + :paramtype origin: str + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: ~azure.mgmt.containerregistry.v2019_05_01.models.OperationDisplayDefinition + :keyword service_specification: The definition of Azure Monitoring service. + :paramtype service_specification: + ~azure.mgmt.containerregistry.v2019_05_01.models.OperationServiceSpecificationDefinition + """ super(OperationDefinition, self).__init__(**kwargs) self.origin = origin self.name = name @@ -518,14 +655,14 @@ def __init__( class OperationDisplayDefinition(msrest.serialization.Model): """The display information for a container registry operation. - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str """ _attribute_map = { @@ -544,6 +681,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ super(OperationDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -554,12 +701,12 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The result of a request to list container registry operations. - :param value: The list of container registry operations. Since this list may be incomplete, the + :ivar value: The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry operations. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -574,6 +721,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -582,18 +737,18 @@ def __init__( class OperationMetricSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring metric. - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str + :ivar name: Metric name. + :vartype name: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -616,6 +771,20 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Metric name. + :paramtype name: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword unit: Metric unit. + :paramtype unit: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword internal_metric_name: Internal metric name. + :paramtype internal_metric_name: str + """ super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -628,8 +797,8 @@ def __init__( class OperationServiceSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring list. - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: list[~azure.mgmt.containerregistry.v2019_05_01.models.OperationMetricSpecificationDefinition] """ @@ -643,6 +812,11 @@ def __init__( metric_specifications: Optional[List["OperationMetricSpecificationDefinition"]] = None, **kwargs ): + """ + :keyword metric_specifications: A list of Azure Monitoring metrics definition. + :paramtype metric_specifications: + list[~azure.mgmt.containerregistry.v2019_05_01.models.OperationMetricSpecificationDefinition] + """ super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -650,12 +824,12 @@ def __init__( class Policies(msrest.serialization.Model): """The policies for a container registry. - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.RetentionPolicy + :ivar quarantine_policy: The quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.QuarantinePolicy + :ivar trust_policy: The content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicy + :ivar retention_policy: The retention policy for a container registry. + :vartype retention_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.RetentionPolicy """ _attribute_map = { @@ -672,6 +846,14 @@ def __init__( retention_policy: Optional["RetentionPolicy"] = None, **kwargs ): + """ + :keyword quarantine_policy: The quarantine policy for a container registry. + :paramtype quarantine_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.QuarantinePolicy + :keyword trust_policy: The content trust policy for a container registry. + :paramtype trust_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicy + :keyword retention_policy: The retention policy for a container registry. + :paramtype retention_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.RetentionPolicy + """ super(Policies, self).__init__(**kwargs) self.quarantine_policy = quarantine_policy self.trust_policy = trust_policy @@ -681,9 +863,9 @@ def __init__( class QuarantinePolicy(msrest.serialization.Model): """The quarantine policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus """ _attribute_map = { @@ -696,6 +878,11 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus + """ super(QuarantinePolicy, self).__init__(**kwargs) self.status = status @@ -705,9 +892,9 @@ class RegenerateCredentialParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName """ _validation = { @@ -724,6 +911,11 @@ def __init__( name: Union[str, "PasswordName"], **kwargs ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName + """ super(RegenerateCredentialParameters, self).__init__(**kwargs) self.name = name @@ -741,11 +933,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -770,6 +962,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -791,13 +990,13 @@ class Registry(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku :ivar login_server: The URL that can be used to log into the container registry. :vartype login_server: str :ivar creation_date: The creation date of the container registry in ISO8601 format. @@ -809,16 +1008,16 @@ class Registry(Resource): ~azure.mgmt.containerregistry.v2019_05_01.models.ProvisioningState :ivar status: The status of the container registry at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2019_05_01.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param storage_account: The properties of the storage account for the container registry. Only + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar storage_account: The properties of the storage account for the container registry. Only applicable to Classic SKU. - :type storage_account: + :vartype storage_account: ~azure.mgmt.containerregistry.v2019_05_01.models.StorageAccountProperties - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies """ _validation = { @@ -862,6 +1061,25 @@ def __init__( policies: Optional["Policies"] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword storage_account: The properties of the storage account for the container registry. + Only applicable to Classic SKU. + :paramtype storage_account: + ~azure.mgmt.containerregistry.v2019_05_01.models.StorageAccountProperties + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies + """ super(Registry, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.login_server = None @@ -877,10 +1095,10 @@ def __init__( class RegistryListCredentialsResult(msrest.serialization.Model): """The response from the ListCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryPassword] + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryPassword] """ _attribute_map = { @@ -895,6 +1113,12 @@ def __init__( passwords: Optional[List["RegistryPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryPassword] + """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -903,11 +1127,11 @@ def __init__( class RegistryListResult(msrest.serialization.Model): """The result of a request to list container registries. - :param value: The list of container registries. Since this list may be incomplete, the nextLink + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str """ _attribute_map = { @@ -922,6 +1146,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ super(RegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -934,8 +1165,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the container registry. - :type name: str + :ivar name: Required. The name of the container registry. + :vartype name: str :ivar type: The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". @@ -960,6 +1191,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ super(RegistryNameCheckRequest, self).__init__(**kwargs) self.name = name @@ -967,13 +1202,13 @@ def __init__( class RegistryNameStatus(msrest.serialization.Model): """The result of a request to check the availability of a container registry name. - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str """ _attribute_map = { @@ -990,6 +1225,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ super(RegistryNameStatus, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -999,10 +1243,10 @@ def __init__( class RegistryPassword(msrest.serialization.Model): """The login password for the container registry. - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName - :param value: The password value. - :type value: str + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName + :ivar value: The password value. + :vartype value: str """ _attribute_map = { @@ -1017,6 +1261,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ super(RegistryPassword, self).__init__(**kwargs) self.name = name self.value = value @@ -1025,16 +1275,16 @@ def __init__( class RegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a container registry. - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies """ _attribute_map = { @@ -1055,6 +1305,18 @@ def __init__( policies: Optional["Policies"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2019_05_01.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: ~azure.mgmt.containerregistry.v2019_05_01.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2019_05_01.models.Policies + """ super(RegistryUpdateParameters, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -1066,14 +1328,14 @@ def __init__( class RegistryUsage(msrest.serialization.Model): """The quota usage for a container registry. - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsageUnit + :ivar name: The name of the usage. + :vartype name: str + :ivar limit: The limit of the usage. + :vartype limit: long + :ivar current_value: The current value of the usage. + :vartype current_value: long + :ivar unit: The unit of measurement. Possible values include: "Count", "Bytes". + :vartype unit: str or ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsageUnit """ _attribute_map = { @@ -1092,6 +1354,16 @@ def __init__( unit: Optional[Union[str, "RegistryUsageUnit"]] = None, **kwargs ): + """ + :keyword name: The name of the usage. + :paramtype name: str + :keyword limit: The limit of the usage. + :paramtype limit: long + :keyword current_value: The current value of the usage. + :paramtype current_value: long + :keyword unit: The unit of measurement. Possible values include: "Count", "Bytes". + :paramtype unit: str or ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsageUnit + """ super(RegistryUsage, self).__init__(**kwargs) self.name = name self.limit = limit @@ -1102,8 +1374,8 @@ def __init__( class RegistryUsageListResult(msrest.serialization.Model): """The result of a request to get container registry quota usages. - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsage] + :ivar value: The list of container registry quota usages. + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsage] """ _attribute_map = { @@ -1116,6 +1388,10 @@ def __init__( value: Optional[List["RegistryUsage"]] = None, **kwargs ): + """ + :keyword value: The list of container registry quota usages. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUsage] + """ super(RegistryUsageListResult, self).__init__(**kwargs) self.value = value @@ -1133,11 +1409,11 @@ class Replication(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar provisioning_state: The provisioning state of the replication at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -1173,6 +1449,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Replication, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.status = None @@ -1181,11 +1464,11 @@ def __init__( class ReplicationListResult(msrest.serialization.Model): """The result of a request to list replications for a container registry. - :param value: The list of replications. Since this list may be incomplete, the nextLink field + :ivar value: The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] + :ivar next_link: The URI that can be used to request the next list of replications. + :vartype next_link: str """ _attribute_map = { @@ -1200,6 +1483,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] + :keyword next_link: The URI that can be used to request the next list of replications. + :paramtype next_link: str + """ super(ReplicationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1208,8 +1498,8 @@ def __init__( class ReplicationUpdateParameters(msrest.serialization.Model): """The parameters for updating a replication. - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] + :ivar tags: A set of tags. The tags for the replication. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1222,6 +1512,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the replication. + :paramtype tags: dict[str, str] + """ super(ReplicationUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -1229,18 +1523,18 @@ def __init__( class Request(msrest.serialization.Model): """The request that generated the event. - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str """ _attribute_map = { @@ -1261,6 +1555,20 @@ def __init__( useragent: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the request that initiated the event. + :paramtype id: str + :keyword addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :paramtype addr: str + :keyword host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :paramtype host: str + :keyword method: The request method that generated the event. + :paramtype method: str + :keyword useragent: The user agent header of the request. + :paramtype useragent: str + """ super(Request, self).__init__(**kwargs) self.id = id self.addr = addr @@ -1274,13 +1582,13 @@ class RetentionPolicy(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int + :ivar days: The number of days to retain an untagged manifest after which it gets purged. + :vartype days: int :ivar last_updated_time: The timestamp when the policy was last updated. :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus """ _validation = { @@ -1300,6 +1608,13 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword days: The number of days to retain an untagged manifest after which it gets purged. + :paramtype days: int + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus + """ super(RetentionPolicy, self).__init__(**kwargs) self.days = days self.last_updated_time = None @@ -1313,9 +1628,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name of the container registry. Required for registry creation. + :ivar name: Required. The SKU name of the container registry. Required for registry creation. Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.SkuName + :vartype name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.SkuName :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", "Standard", "Premium". :vartype tier: str or ~azure.mgmt.containerregistry.v2019_05_01.models.SkuTier @@ -1337,6 +1652,11 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Possible values include: "Classic", "Basic", "Standard", "Premium". + :paramtype name: str or ~azure.mgmt.containerregistry.v2019_05_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1345,11 +1665,11 @@ def __init__( class Source(msrest.serialization.Model): """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :param addr: The IP or hostname and the port of the registry node that generated the event. + :ivar addr: The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str """ _attribute_map = { @@ -1364,6 +1684,13 @@ def __init__( instance_id: Optional[str] = None, **kwargs ): + """ + :keyword addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :paramtype addr: str + :keyword instance_id: The running instance of an application. Changes after each restart. + :paramtype instance_id: str + """ super(Source, self).__init__(**kwargs) self.addr = addr self.instance_id = instance_id @@ -1398,6 +1725,8 @@ def __init__( self, **kwargs ): + """ + """ super(Status, self).__init__(**kwargs) self.display_status = None self.message = None @@ -1409,8 +1738,8 @@ class StorageAccountProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The resource ID of the storage account. - :type id: str + :ivar id: Required. The resource ID of the storage account. + :vartype id: str """ _validation = { @@ -1427,6 +1756,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The resource ID of the storage account. + :paramtype id: str + """ super(StorageAccountProperties, self).__init__(**kwargs) self.id = id @@ -1434,24 +1767,24 @@ def __init__( class Target(msrest.serialization.Model): """The target of the event. - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: long + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: long + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str """ _attribute_map = { @@ -1480,6 +1813,27 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword media_type: The MIME type of the referenced object. + :paramtype media_type: str + :keyword size: The number of bytes of the content. Same as Length field. + :paramtype size: long + :keyword digest: The digest of the content, as defined by the Registry V2 HTTP API + Specification. + :paramtype digest: str + :keyword length: The number of bytes of the content. Same as Size field. + :paramtype length: long + :keyword repository: The repository name. + :paramtype repository: str + :keyword url: The direct URL to the content. + :paramtype url: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword name: The name of the artifact. + :paramtype name: str + :keyword version: The version of the artifact. + :paramtype version: str + """ super(Target, self).__init__(**kwargs) self.media_type = media_type self.size = size @@ -1495,12 +1849,12 @@ def __init__( class TrustPolicy(msrest.serialization.Model): """The content trust policy for a container registry. - :param type: The type of trust policy. Possible values include: "Notary". Default value: + :ivar type: The type of trust policy. Possible values include: "Notary". Default value: "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values + :vartype type: str or ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus """ _attribute_map = { @@ -1515,6 +1869,14 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :paramtype type: str or ~azure.mgmt.containerregistry.v2019_05_01.models.TrustPolicyType + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.PolicyStatus + """ super(TrustPolicy, self).__init__(**kwargs) self.type = type self.status = status @@ -1525,11 +1887,11 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar action: The action of virtual network rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str + :vartype virtual_network_resource_id: str """ _validation = { @@ -1548,6 +1910,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of virtual network rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2019_05_01.models.Action + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.action = action self.virtual_network_resource_id = virtual_network_resource_id @@ -1566,20 +1935,20 @@ class Webhook(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] :ivar provisioning_state: The provisioning state of the webhook at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -1617,6 +1986,22 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] + """ super(Webhook, self).__init__(location=location, tags=tags, **kwargs) self.status = status self.scope = scope @@ -1629,24 +2014,24 @@ class WebhookCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the webhook. This cannot be changed after the resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] """ _validation = { @@ -1675,6 +2060,26 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] + """ super(WebhookCreateParameters, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1688,11 +2093,11 @@ def __init__( class WebhookListResult(msrest.serialization.Model): """The result of a request to list webhooks for a container registry. - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str + :ivar value: The list of webhooks. Since this list may be incomplete, the nextLink field should + be used to request the next list of webhooks. + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] + :ivar next_link: The URI that can be used to request the next list of webhooks. + :vartype next_link: str """ _attribute_map = { @@ -1707,6 +2112,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] + :keyword next_link: The URI that can be used to request the next list of webhooks. + :paramtype next_link: str + """ super(WebhookListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1715,21 +2127,21 @@ def __init__( class WebhookUpdateParameters(msrest.serialization.Model): """The parameters for updating a webhook. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] """ _attribute_map = { @@ -1752,6 +2164,23 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookAction] + """ super(WebhookUpdateParameters, self).__init__(**kwargs) self.tags = tags self.service_uri = service_uri diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_operations.py index 081a21ba00b1..bd21568135ba 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Container Registry REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_registries_operations.py index 0b15bb9d1611..a7df0e06af04 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_registries_operations.py @@ -5,25 +5,440 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_import_image_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -49,41 +464,32 @@ def __init__(self, client, config, serializer, deserializer): def _import_image_initial( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,14 +502,15 @@ def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace def begin_import_image( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> LROPoller[None]: """Copies an image to this container registry from the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -116,15 +523,18 @@ def begin_import_image( :type parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -136,24 +546,18 @@ def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -165,20 +569,22 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace def check_name_availability( self, - registry_name_check_request, # type: "_models.RegistryNameCheckRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryNameStatus" + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": """Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryNameStatus @@ -189,30 +595,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,15 +622,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": """Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -252,27 +650,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,47 +674,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -344,16 +723,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -365,15 +746,19 @@ def begin_create( :type registry: ~azure.mgmt.containerregistry.v2019_05_01.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,27 +770,21 @@ def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -417,39 +796,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -462,13 +833,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -478,15 +850,17 @@ def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -500,21 +874,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -526,47 +893,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -584,16 +941,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -602,18 +961,23 @@ def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -625,27 +989,21 @@ def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,14 +1015,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry @@ -672,7 +1031,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -680,35 +1040,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -726,21 +1082,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -748,34 +1106,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,18 +1146,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -822,27 +1176,17 @@ def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -856,16 +1200,18 @@ def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace def regenerate_credential( self, - resource_group_name, # type: str - registry_name, # type: str - regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -875,7 +1221,8 @@ def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_05_01.models.RegistryListCredentialsResult @@ -886,32 +1233,22 @@ def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -925,15 +1262,17 @@ def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace def list_usages( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryUsageListResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": """Gets the quota usages for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -951,27 +1290,17 @@ def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,4 +1314,6 @@ def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_replications_operations.py index 962fb5796c6b..ca42d5deb84c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_replications_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReplicationsOperations(object): """ReplicationsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": """Gets the properties of the specified replication. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Creates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,20 @@ def begin_create( :type replication: ~azure.mgmt.containerregistry.v2019_05_01.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a replication from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Updates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,24 @@ def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +632,21 @@ def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +658,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationListResult"]: """Lists all the replications for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -518,8 +676,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -527,36 +687,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +731,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_webhooks_operations.py index 15f3d750ec90..6aa93ae3245f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/operations/_webhooks_operations.py @@ -5,25 +5,334 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_ping_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_callback_config_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_events_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebhooksOperations(object): """WebhooksOperations operations. @@ -47,14 +356,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": """Gets the properties of the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +383,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +408,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +459,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Creates a webhook for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +482,22 @@ def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +510,21 @@ def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +536,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +575,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a webhook from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +595,17 @@ def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +620,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +639,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +689,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Updates a webhook with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +712,22 @@ def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +740,21 @@ def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +766,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebhookListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.WebhookListResult"]: """Lists all the webhooks for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +785,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.WebhookListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -527,36 +794,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,19 +838,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace def ping( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventInfo" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": """Triggers a ping event to be sent to the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +871,18 @@ def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +896,18 @@ def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace def get_callback_config( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CallbackConfig" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": """Gets the configuration of service URI and custom headers for the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -670,28 +927,18 @@ def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -705,16 +952,18 @@ def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventListResult"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> Iterable["_models.EventListResult"]: """Lists recent events for the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -726,7 +975,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.EventListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -734,37 +984,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -782,6 +1030,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_configuration.py index 6595f87d5c8b..ac9a7cc76aa2 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_container_registry_management_client.py index 37353f59da45..802dfb7ca143 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_container_registry_management_client.py @@ -6,84 +6,86 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import RegistriesOperations, ScopeMapsOperations, TokensOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import RegistriesOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2019_05_01_preview.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2019_05_01_preview.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations :vartype tokens: azure.mgmt.containerregistry.v2019_05_01_preview.operations.TokensOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_05_01_preview.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_05_01_preview.operations.RegistriesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_metadata.json index a0ef50b45a3c..b665d244ec19 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "scope_maps": "ScopeMapsOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_configuration.py index d5ea38175395..65c68dd0e8f5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_container_registry_management_client.py index 187b1190f08b..d904c0f6392a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_container_registry_management_client.py @@ -6,80 +6,87 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import RegistriesOperations, ScopeMapsOperations, TokensOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import RegistriesOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2019_05_01_preview.aio.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2019_05_01_preview.aio.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations - :vartype tokens: azure.mgmt.containerregistry.v2019_05_01_preview.aio.operations.TokensOperations + :vartype tokens: + azure.mgmt.containerregistry.v2019_05_01_preview.aio.operations.TokensOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_05_01_preview.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_05_01_preview.aio.operations.RegistriesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_registries_operations.py index 2944de316cb2..cc0ffefcc828 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_registries_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_generate_credentials_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,32 +58,22 @@ async def _generate_credentials_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') + + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -95,8 +89,11 @@ async def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace_async async def begin_generate_credentials( self, resource_group_name: str, @@ -112,18 +109,24 @@ async def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -135,27 +138,21 @@ async def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -167,4 +164,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_scope_maps_operations.py index f0be8d394a95..19bffde83cf9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_scope_maps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._scope_maps_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_tokens_operations.py index 61dffec6bf4d..e51fcef985d5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/aio/operations/_tokens_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tokens_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_create_parameters, 'Token') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,19 @@ async def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +202,21 @@ async def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +228,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _delete_initial( @@ -254,26 +243,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +267,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +287,17 @@ async def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +312,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +331,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _update_initial( @@ -369,33 +347,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +381,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +404,23 @@ async def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +433,21 @@ async def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +459,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +478,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -515,36 +487,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +531,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/__init__.py index 062118826a3f..9f28cef5c689 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/__init__.py @@ -6,36 +6,21 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActiveDirectoryObject - from ._models_py3 import GenerateCredentialsParameters - from ._models_py3 import GenerateCredentialsResult - from ._models_py3 import ProxyResource - from ._models_py3 import ScopeMap - from ._models_py3 import ScopeMapListResult - from ._models_py3 import ScopeMapUpdateParameters - from ._models_py3 import SystemData - from ._models_py3 import Token - from ._models_py3 import TokenCertificate - from ._models_py3 import TokenCredentialsProperties - from ._models_py3 import TokenListResult - from ._models_py3 import TokenPassword - from ._models_py3 import TokenUpdateParameters -except (SyntaxError, ImportError): - from ._models import ActiveDirectoryObject # type: ignore - from ._models import GenerateCredentialsParameters # type: ignore - from ._models import GenerateCredentialsResult # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import ScopeMap # type: ignore - from ._models import ScopeMapListResult # type: ignore - from ._models import ScopeMapUpdateParameters # type: ignore - from ._models import SystemData # type: ignore - from ._models import Token # type: ignore - from ._models import TokenCertificate # type: ignore - from ._models import TokenCredentialsProperties # type: ignore - from ._models import TokenListResult # type: ignore - from ._models import TokenPassword # type: ignore - from ._models import TokenUpdateParameters # type: ignore +from ._models_py3 import ActiveDirectoryObject +from ._models_py3 import GenerateCredentialsParameters +from ._models_py3 import GenerateCredentialsResult +from ._models_py3 import ProxyResource +from ._models_py3 import ScopeMap +from ._models_py3 import ScopeMapListResult +from ._models_py3 import ScopeMapUpdateParameters +from ._models_py3 import SystemData +from ._models_py3 import Token +from ._models_py3 import TokenCertificate +from ._models_py3 import TokenCredentialsProperties +from ._models_py3 import TokenListResult +from ._models_py3 import TokenPassword +from ._models_py3 import TokenUpdateParameters + from ._container_registry_management_client_enums import ( CreatedByType, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_container_registry_management_client_enums.py index 4a1712b488cd..c885f77e3ec1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_container_registry_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -35,7 +20,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -44,7 +29,7 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the resource. """ @@ -55,19 +40,19 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class TokenCertificateName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenCertificateName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CERTIFICATE1 = "certificate1" CERTIFICATE2 = "certificate2" -class TokenPasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenPasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name "password1" or "password2" """ PASSWORD1 = "password1" PASSWORD2 = "password2" -class TokenStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the token example enabled or disabled. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models.py deleted file mode 100644 index bb5ee826ab57..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models.py +++ /dev/null @@ -1,499 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ActiveDirectoryObject(msrest.serialization.Model): - """The Active Directory Object that will be used for authenticating the token of a container registry. - - :param object_id: The user/group/application object ID for Active Directory Object that will be - used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that - will be used for authenticating the token of a container registry. - :type tenant_id: str - """ - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryObject, self).__init__(**kwargs) - self.object_id = kwargs.get('object_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - - -class GenerateCredentialsParameters(msrest.serialization.Model): - """The parameters used to generate credentials for a specified token or user of a container registry. - - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become - invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or - password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName - """ - - _attribute_map = { - 'token_id': {'key': 'tokenId', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsParameters, self).__init__(**kwargs) - self.token_id = kwargs.get('token_id', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - - -class GenerateCredentialsResult(msrest.serialization.Model): - """The response from the GenerateCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ScopeMap(ProxyResource): - """An object that represents a scope map for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str - :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. - :vartype type_properties_type: str - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. - E.g. repositories/repository-name/content/read, - repositories/repository-name/metadata/write. - :type actions: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'type_properties_type': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMap, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.type_properties_type = None - self.creation_date = None - self.provisioning_state = None - self.actions = kwargs.get('actions', None) - - -class ScopeMapListResult(msrest.serialization.Model): - """The result of a request to list scope maps for a container registry. - - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field - should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScopeMap]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ScopeMapUpdateParameters(msrest.serialization.Model): - """The properties for updating the scope map. - - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. - E.g. repositories/repository-name/pull, - repositories/repository-name/delete. - :type actions: list[str] - """ - - _attribute_map = { - 'description': {'key': 'properties.description', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapUpdateParameters, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.actions = kwargs.get('actions', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Token(ProxyResource): - """An object that represents a token for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.SystemData - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Token, self).__init__(**kwargs) - self.creation_date = None - self.provisioning_state = None - self.scope_map_id = kwargs.get('scope_map_id', None) - self.credentials = kwargs.get('credentials', None) - self.status = kwargs.get('status', None) - - -class TokenCertificate(msrest.serialization.Model): - """The properties of a certificate used for authenticating a token. - - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format - that will be used for authenticating the token. - :type encoded_pem_certificate: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'encoded_pem_certificate': {'key': 'encodedPemCertificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCertificate, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.expiry = kwargs.get('expiry', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.encoded_pem_certificate = kwargs.get('encoded_pem_certificate', None) - - -class TokenCredentialsProperties(msrest.serialization.Model): - """The properties of the credentials that can be used for authenticating the token. - - :param active_directory_object: The Active Directory Object that will be used for - authenticating the token of a container registry. - :type active_directory_object: - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ActiveDirectoryObject - :param certificates: - :type certificates: - list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'active_directory_object': {'key': 'activeDirectoryObject', 'type': 'ActiveDirectoryObject'}, - 'certificates': {'key': 'certificates', 'type': '[TokenCertificate]'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCredentialsProperties, self).__init__(**kwargs) - self.active_directory_object = kwargs.get('active_directory_object', None) - self.certificates = kwargs.get('certificates', None) - self.passwords = kwargs.get('passwords', None) - - -class TokenListResult(msrest.serialization.Model): - """The result of a request to list tokens for a container registry. - - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should - be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Token]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TokenPassword(msrest.serialization.Model): - """The password that will be used for authenticating the token of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName - :ivar value: The password value. - :vartype value: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenPassword, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - self.value = None - - -class TokenUpdateParameters(msrest.serialization.Model): - """The parameters for updating a token. - - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCredentialsProperties - """ - - _attribute_map = { - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenUpdateParameters, self).__init__(**kwargs) - self.scope_map_id = kwargs.get('scope_map_id', None) - self.status = kwargs.get('status', None) - self.credentials = kwargs.get('credentials', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models_py3.py index 1448f458331c..88be7d322550 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/models/_models_py3.py @@ -17,12 +17,12 @@ class ActiveDirectoryObject(msrest.serialization.Model): """The Active Directory Object that will be used for authenticating the token of a container registry. - :param object_id: The user/group/application object ID for Active Directory Object that will be + :ivar object_id: The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that + :vartype object_id: str + :ivar tenant_id: The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. - :type tenant_id: str + :vartype tenant_id: str """ _attribute_map = { @@ -37,6 +37,14 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword object_id: The user/group/application object ID for Active Directory Object that will + be used for authenticating the token of a container registry. + :paramtype object_id: str + :keyword tenant_id: The tenant ID of user/group/application object Active Directory Object that + will be used for authenticating the token of a container registry. + :paramtype tenant_id: str + """ super(ActiveDirectoryObject, self).__init__(**kwargs) self.object_id = object_id self.tenant_id = tenant_id @@ -45,14 +53,15 @@ def __init__( class GenerateCredentialsParameters(msrest.serialization.Model): """The parameters used to generate credentials for a specified token or user of a container registry. - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become + :ivar token_id: The resource ID of the token for which credentials have to be generated. + :vartype token_id: str + :ivar expiry: The expiry date of the generated credentials after which the credentials become invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or + :vartype expiry: ~datetime.datetime + :ivar name: Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName + :vartype name: str or + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName """ _attribute_map = { @@ -69,6 +78,17 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword token_id: The resource ID of the token for which credentials have to be generated. + :paramtype token_id: str + :keyword expiry: The expiry date of the generated credentials after which the credentials + become invalid. + :paramtype expiry: ~datetime.datetime + :keyword name: Specifies name of the password which should be regenerated if any -- password1 + or password2. Possible values include: "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName + """ super(GenerateCredentialsParameters, self).__init__(**kwargs) self.token_id = token_id self.expiry = expiry @@ -78,10 +98,11 @@ def __init__( class GenerateCredentialsResult(msrest.serialization.Model): """The response from the GenerateCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: + list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] """ _attribute_map = { @@ -96,6 +117,13 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] + """ super(GenerateCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -134,6 +162,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -154,8 +184,8 @@ class ScopeMap(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str + :ivar description: The user friendly description of the scope map. + :vartype description: str :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. :vartype type_properties_type: str :ivar creation_date: The creation date of scope map. @@ -164,10 +194,10 @@ class ScopeMap(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. + :ivar actions: The list of scoped permissions for registry artifacts. E.g. repositories/repository-name/content/read, repositories/repository-name/metadata/write. - :type actions: list[str] + :vartype actions: list[str] """ _validation = { @@ -199,6 +229,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. + :paramtype actions: list[str] + """ super(ScopeMap, self).__init__(**kwargs) self.description = description self.type_properties_type = None @@ -210,11 +248,11 @@ def __init__( class ScopeMapListResult(msrest.serialization.Model): """The result of a request to list scope maps for a container registry. - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field + :ivar value: The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] + :ivar next_link: The URI that can be used to request the next list of scope maps. + :vartype next_link: str """ _attribute_map = { @@ -229,6 +267,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of scope maps. Since this list may be incomplete, the nextLink field + should be used to request the next list of scope maps. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] + :keyword next_link: The URI that can be used to request the next list of scope maps. + :paramtype next_link: str + """ super(ScopeMapListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -237,12 +282,12 @@ def __init__( class ScopeMapUpdateParameters(msrest.serialization.Model): """The properties for updating the scope map. - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. + :ivar description: The user friendly description of the scope map. + :vartype description: str + :ivar actions: The list of scope permissions for registry artifacts. E.g. repositories/repository-name/pull, repositories/repository-name/delete. - :type actions: list[str] + :vartype actions: list[str] """ _attribute_map = { @@ -257,6 +302,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scope permissions for registry artifacts. + E.g. repositories/repository-name/pull, + repositories/repository-name/delete. + :paramtype actions: list[str] + """ super(ScopeMapUpdateParameters, self).__init__(**kwargs) self.description = description self.actions = actions @@ -265,22 +318,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :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: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -303,6 +356,24 @@ def __init__( 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". + :paramtype created_by_type: str or + ~azure.mgmt.containerregistry.v2019_05_01_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". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -331,15 +402,15 @@ class Token(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype scope_map_id: str + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus """ _validation = { @@ -371,6 +442,17 @@ def __init__( status: Optional[Union[str, "TokenStatus"]] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCredentialsProperties + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus + """ super(Token, self).__init__(**kwargs) self.creation_date = None self.provisioning_state = None @@ -382,16 +464,16 @@ def __init__( class TokenCertificate(msrest.serialization.Model): """The properties of a certificate used for authenticating a token. - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or + :ivar name: Possible values include: "certificate1", "certificate2". + :vartype name: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format + :ivar expiry: The expiry datetime of the certificate. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The thumbprint of the certificate. + :vartype thumbprint: str + :ivar encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - :type encoded_pem_certificate: str + :vartype encoded_pem_certificate: str """ _attribute_map = { @@ -410,6 +492,18 @@ def __init__( encoded_pem_certificate: Optional[str] = None, **kwargs ): + """ + :keyword name: Possible values include: "certificate1", "certificate2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCertificateName + :keyword expiry: The expiry datetime of the certificate. + :paramtype expiry: ~datetime.datetime + :keyword thumbprint: The thumbprint of the certificate. + :paramtype thumbprint: str + :keyword encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM + format that will be used for authenticating the token. + :paramtype encoded_pem_certificate: str + """ super(TokenCertificate, self).__init__(**kwargs) self.name = name self.expiry = expiry @@ -420,15 +514,16 @@ def __init__( class TokenCredentialsProperties(msrest.serialization.Model): """The properties of the credentials that can be used for authenticating the token. - :param active_directory_object: The Active Directory Object that will be used for - authenticating the token of a container registry. - :type active_directory_object: + :ivar active_directory_object: The Active Directory Object that will be used for authenticating + the token of a container registry. + :vartype active_directory_object: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ActiveDirectoryObject - :param certificates: - :type certificates: + :ivar certificates: + :vartype certificates: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] + :ivar passwords: + :vartype passwords: + list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] """ _attribute_map = { @@ -445,6 +540,18 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword active_directory_object: The Active Directory Object that will be used for + authenticating the token of a container registry. + :paramtype active_directory_object: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ActiveDirectoryObject + :keyword certificates: + :paramtype certificates: + list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCertificate] + :keyword passwords: + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPassword] + """ super(TokenCredentialsProperties, self).__init__(**kwargs) self.active_directory_object = active_directory_object self.certificates = certificates @@ -454,11 +561,11 @@ def __init__( class TokenListResult(msrest.serialization.Model): """The result of a request to list tokens for a container registry. - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should + :ivar value: The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] + :ivar next_link: The URI that can be used to request the next list of tokens. + :vartype next_link: str """ _attribute_map = { @@ -473,6 +580,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of tokens. Since this list may be incomplete, the nextLink field + should be used to request the next list of tokens. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] + :keyword next_link: The URI that can be used to request the next list of tokens. + :paramtype next_link: str + """ super(TokenListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -483,13 +597,14 @@ class TokenPassword(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName + :ivar creation_time: The creation datetime of the password. + :vartype creation_time: ~datetime.datetime + :ivar expiry: The expiry datetime of the password. + :vartype expiry: ~datetime.datetime + :ivar name: The password name "password1" or "password2". Possible values include: "password1", + "password2". + :vartype name: str or + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName :ivar value: The password value. :vartype value: str """ @@ -513,6 +628,16 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword creation_time: The creation datetime of the password. + :paramtype creation_time: ~datetime.datetime + :keyword expiry: The expiry datetime of the password. + :paramtype expiry: ~datetime.datetime + :keyword name: The password name "password1" or "password2". Possible values include: + "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenPasswordName + """ super(TokenPassword, self).__init__(**kwargs) self.creation_time = creation_time self.expiry = expiry @@ -523,14 +648,14 @@ def __init__( class TokenUpdateParameters(msrest.serialization.Model): """The parameters for updating a token. - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: + :vartype scope_map_id: str + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCredentialsProperties """ @@ -548,6 +673,17 @@ def __init__( credentials: Optional["TokenCredentialsProperties"] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenStatus + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenCredentialsProperties + """ super(TokenUpdateParameters, self).__init__(**kwargs) self.scope_map_id = scope_map_id self.status = status diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_registries_operations.py index 72b291458e8e..81cc3c7a2a34 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_registries_operations.py @@ -5,24 +5,71 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_generate_credentials_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -48,43 +95,32 @@ def __init__(self, client, config, serializer, deserializer): def _generate_credentials_initial( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> Optional["_models.GenerateCredentialsResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateCredentialsResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') + + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,16 +136,18 @@ def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace def begin_generate_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> LROPoller["_models.GenerateCredentialsResult"]: """Generate keys for a token of a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -118,18 +156,24 @@ def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,27 +185,21 @@ def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -173,4 +211,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_scope_maps_operations.py index fb6b39c0b76e..c5ca74845f6f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_scope_maps_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ScopeMapsOperations(object): """ScopeMapsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> "_models.ScopeMap": """Gets the properties of the specified scope map. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Creates a scope map for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +371,23 @@ def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a scope map from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Updates a scope map with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,23 @@ def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +631,21 @@ def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +657,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScopeMapListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ScopeMapListResult"]: """Lists all the scope maps for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +676,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -527,36 +685,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_tokens_operations.py index 9945618d5230..2d92e68ec10f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/operations/_tokens_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TokensOperations(object): """TokensOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> "_models.Token": """Gets the properties of the specified token. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_create_parameters, 'Token') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Creates a token for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,19 @@ def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +399,21 @@ def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +425,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +464,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a token from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +484,17 @@ def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +509,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +528,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +578,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Updates a token with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +601,23 @@ def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_05_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +630,21 @@ def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +656,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TokenListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TokenListResult"]: """Lists all the tokens for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +675,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_05_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -527,36 +684,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +728,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_configuration.py index 4d31b663f662..540a263b7359 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_container_registry_management_client.py index db38444f3e60..6adaf4c0953e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_container_registry_management_client.py @@ -6,94 +6,93 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import AgentPoolsOperations, RegistriesOperations, RunsOperations, TaskRunsOperations, TasksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import AgentPoolsOperations -from .operations import RegistriesOperations -from .operations import RunsOperations -from .operations import TaskRunsOperations -from .operations import TasksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar agent_pools: AgentPoolsOperations operations - :vartype agent_pools: azure.mgmt.containerregistry.v2019_06_01_preview.operations.AgentPoolsOperations + :vartype agent_pools: + azure.mgmt.containerregistry.v2019_06_01_preview.operations.AgentPoolsOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_06_01_preview.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_06_01_preview.operations.RegistriesOperations :ivar runs: RunsOperations operations :vartype runs: azure.mgmt.containerregistry.v2019_06_01_preview.operations.RunsOperations :ivar task_runs: TaskRunsOperations operations - :vartype task_runs: azure.mgmt.containerregistry.v2019_06_01_preview.operations.TaskRunsOperations + :vartype task_runs: + azure.mgmt.containerregistry.v2019_06_01_preview.operations.TaskRunsOperations :ivar tasks: TasksOperations operations :vartype tasks: azure.mgmt.containerregistry.v2019_06_01_preview.operations.TasksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.task_runs = TaskRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.runs = RunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.task_runs = TaskRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_metadata.json index c3608188262c..d2da77eb93a5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "agent_pools": "AgentPoolsOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_configuration.py index 77b41c5c96b1..17c9c0ab7df0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_container_registry_management_client.py index f2068311fd77..4c907268a515 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_container_registry_management_client.py @@ -6,90 +6,93 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import AgentPoolsOperations, RegistriesOperations, RunsOperations, TaskRunsOperations, TasksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import AgentPoolsOperations -from .operations import RegistriesOperations -from .operations import RunsOperations -from .operations import TaskRunsOperations -from .operations import TasksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar agent_pools: AgentPoolsOperations operations - :vartype agent_pools: azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.AgentPoolsOperations + :vartype agent_pools: + azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.AgentPoolsOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.RegistriesOperations :ivar runs: RunsOperations operations :vartype runs: azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.RunsOperations :ivar task_runs: TaskRunsOperations operations - :vartype task_runs: azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.TaskRunsOperations + :vartype task_runs: + azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.TaskRunsOperations :ivar tasks: TasksOperations operations :vartype tasks: azure.mgmt.containerregistry.v2019_06_01_preview.aio.operations.TasksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.task_runs = TaskRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) + - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.runs = RunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.task_runs = TaskRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_agent_pools_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_agent_pools_operations.py index 7917708379e5..c740c2632f3b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_agent_pools_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._agent_pools_operations import build_create_request_initial, build_delete_request_initial, build_get_queue_status_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,34 +75,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgentPool', pipeline_response) @@ -105,8 +101,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -120,40 +118,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool, 'AgentPool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(agent_pool, 'AgentPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('AgentPool', pipeline_response) @@ -165,8 +152,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -188,15 +178,20 @@ async def begin_create( :type agent_pool: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,28 +204,21 @@ async def begin_create( registry_name=registry_name, agent_pool_name=agent_pool_name, agent_pool=agent_pool, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -242,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore async def _delete_initial( @@ -256,41 +245,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -309,15 +289,17 @@ async def begin_delete( :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore async def _update_initial( @@ -374,40 +349,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(update_parameters, 'AgentPoolUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_parameters, 'AgentPoolUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('AgentPool', pipeline_response) @@ -419,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,18 +406,24 @@ async def begin_update( :param agent_pool_name: The name of the agent pool. :type agent_pool_name: str :param update_parameters: The parameters for updating an agent pool. - :type update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolUpdateParameters + :type update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,28 +436,21 @@ async def begin_update( registry_name=registry_name, agent_pool_name=agent_pool_name, update_parameters=update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -496,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -513,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] @@ -521,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AgentPoolListResult', pipeline_response) + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,17 +529,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools'} # type: ignore + @distributed_trace_async async def get_queue_status( self, resource_group_name: str, @@ -600,34 +568,24 @@ async def get_queue_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_queue_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_queue_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + template_url=self.get_queue_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgentPoolQueueStatus', pipeline_response) @@ -636,4 +594,6 @@ async def get_queue_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_queue_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_registries_operations.py index fc2adcb22493..6b9299823124 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_registries_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_get_build_source_upload_url_request, build_schedule_run_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,39 +58,28 @@ async def _schedule_run_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._schedule_run_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_request, 'RunRequest') + + request = build_schedule_run_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._schedule_run_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_request, 'RunRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -96,8 +89,11 @@ async def _schedule_run_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _schedule_run_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + + @distributed_trace_async async def begin_schedule_run( self, resource_group_name: str, @@ -116,15 +112,19 @@ async def begin_schedule_run( :type run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -136,27 +136,21 @@ async def begin_schedule_run( resource_group_name=resource_group_name, registry_name=registry_name, run_request=run_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -168,8 +162,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_schedule_run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + @distributed_trace_async async def get_build_source_upload_url( self, resource_group_name: str, @@ -193,33 +189,23 @@ async def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceUploadDefinition', pipeline_response) @@ -228,4 +214,6 @@ async def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_runs_operations.py index 9286a307f237..e0cd5ad59873 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runs_operations import build_cancel_request_initial, build_get_log_sas_url_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,7 +73,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunListResult"] @@ -75,40 +82,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RunListResult', pipeline_response) + deserialized = self._deserialize("RunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,17 +125,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -158,34 +164,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Run', pipeline_response) @@ -194,8 +190,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -209,40 +207,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_update_parameters, 'RunUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_update_parameters, 'RunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Run', pipeline_response) @@ -254,8 +241,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -274,18 +264,23 @@ async def begin_update( :param run_id: The run ID. :type run_id: str :param run_update_parameters: The run update properties. - :type run_update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunUpdateParameters + :type run_update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,28 +293,21 @@ async def begin_update( registry_name=registry_name, run_id=run_id, run_update_parameters=run_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,8 +319,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + @distributed_trace_async async def get_log_sas_url( self, resource_group_name: str, @@ -359,34 +349,24 @@ async def get_log_sas_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_sas_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_sas_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get_log_sas_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RunGetLogResult', pipeline_response) @@ -395,8 +375,10 @@ async def get_log_sas_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_sas_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl'} # type: ignore + async def _cancel_initial( self, resource_group_name: str, @@ -409,41 +391,32 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -462,15 +435,17 @@ async def begin_cancel( :type run_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -485,22 +460,14 @@ async def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,4 +479,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_task_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_task_runs_operations.py index 4a17e3c79f99..2fc88018fd1d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_task_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_task_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._task_runs_operations import build_create_request_initial, build_delete_request_initial, build_get_details_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,34 +75,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TaskRun', pipeline_response) @@ -105,8 +101,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -120,40 +118,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_run, 'TaskRun') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_run, 'TaskRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('TaskRun', pipeline_response) @@ -165,8 +152,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -188,15 +178,20 @@ async def begin_create( :type task_run: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TaskRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,28 +204,21 @@ async def begin_create( registry_name=registry_name, task_run_name=task_run_name, task_run=task_run, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('TaskRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -242,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore async def _delete_initial( @@ -256,41 +245,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -309,15 +289,17 @@ async def begin_delete( :type task_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore async def _update_initial( @@ -374,40 +349,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(update_parameters, 'TaskRunUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_parameters, 'TaskRunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('TaskRun', pipeline_response) @@ -419,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,18 +406,24 @@ async def begin_update( :param task_run_name: The name of the task run. :type task_run_name: str :param update_parameters: The parameters for updating a task run. - :type update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunUpdateParameters + :type update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TaskRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,28 +436,21 @@ async def begin_update( registry_name=registry_name, task_run_name=task_run_name, update_parameters=update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('TaskRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -496,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + @distributed_trace_async async def get_details( self, resource_group_name: str, @@ -524,34 +492,24 @@ async def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TaskRun', pipeline_response) @@ -560,8 +518,11 @@ async def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -577,7 +538,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskRunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRunListResult"] @@ -585,36 +547,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TaskRunListResult', pipeline_response) + deserialized = self._deserialize("TaskRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -627,12 +586,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_tasks_operations.py index 00e0a981beaa..b4b597736267 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_tasks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tasks_operations import build_create_request_initial, build_delete_request_initial, build_get_details_request, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskListResult"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TaskListResult', pipeline_response) + deserialized = self._deserialize("TaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,34 +151,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Task', pipeline_response) @@ -181,8 +177,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,40 +194,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_create_parameters, 'Task') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_create_parameters, 'Task') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Task', pipeline_response) @@ -241,8 +228,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -264,15 +254,19 @@ async def begin_create( :type task_create_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +279,21 @@ async def begin_create( registry_name=registry_name, task_name=task_name, task_create_parameters=task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore async def _delete_initial( @@ -332,41 +320,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -385,15 +364,17 @@ async def begin_delete( :type task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +389,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -435,6 +408,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore async def _update_initial( @@ -450,40 +424,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Task', pipeline_response) @@ -495,8 +458,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -515,18 +481,23 @@ async def begin_update( :param task_name: The name of the container registry task. :type task_name: str :param task_update_parameters: The parameters for updating a task. - :type task_update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskUpdateParameters + :type task_update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -539,28 +510,21 @@ async def begin_update( registry_name=registry_name, task_name=task_name, task_update_parameters=task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -572,8 +536,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + @distributed_trace_async async def get_details( self, resource_group_name: str, @@ -600,34 +566,24 @@ async def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Task', pipeline_response) @@ -636,4 +592,6 @@ async def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py index 54dfeeb645c3..b73390bb476a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py @@ -6,136 +6,71 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AgentPool - from ._models_py3 import AgentPoolListResult - from ._models_py3 import AgentPoolQueueStatus - from ._models_py3 import AgentPoolUpdateParameters - from ._models_py3 import AgentProperties - from ._models_py3 import Argument - from ._models_py3 import AuthInfo - from ._models_py3 import AuthInfoUpdateParameters - from ._models_py3 import BaseImageDependency - from ._models_py3 import BaseImageTrigger - from ._models_py3 import BaseImageTriggerUpdateParameters - from ._models_py3 import Credentials - from ._models_py3 import CustomRegistryCredentials - from ._models_py3 import DockerBuildRequest - from ._models_py3 import DockerBuildStep - from ._models_py3 import DockerBuildStepUpdateParameters - from ._models_py3 import EncodedTaskRunRequest - from ._models_py3 import EncodedTaskStep - from ._models_py3 import EncodedTaskStepUpdateParameters - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import FileTaskRunRequest - from ._models_py3 import FileTaskStep - from ._models_py3 import FileTaskStepUpdateParameters - from ._models_py3 import IdentityProperties - from ._models_py3 import ImageDescriptor - from ._models_py3 import ImageUpdateTrigger - from ._models_py3 import InnerErrorDescription - from ._models_py3 import OverrideTaskStepProperties - from ._models_py3 import PlatformProperties - from ._models_py3 import PlatformUpdateParameters - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import Run - from ._models_py3 import RunFilter - from ._models_py3 import RunGetLogResult - from ._models_py3 import RunListResult - from ._models_py3 import RunRequest - from ._models_py3 import RunUpdateParameters - from ._models_py3 import SecretObject - from ._models_py3 import SetValue - from ._models_py3 import SourceProperties - from ._models_py3 import SourceRegistryCredentials - from ._models_py3 import SourceTrigger - from ._models_py3 import SourceTriggerDescriptor - from ._models_py3 import SourceTriggerUpdateParameters - from ._models_py3 import SourceUpdateParameters - from ._models_py3 import SourceUploadDefinition - from ._models_py3 import SystemData - from ._models_py3 import Task - from ._models_py3 import TaskListResult - from ._models_py3 import TaskRun - from ._models_py3 import TaskRunListResult - from ._models_py3 import TaskRunRequest - from ._models_py3 import TaskRunUpdateParameters - from ._models_py3 import TaskStepProperties - from ._models_py3 import TaskStepUpdateParameters - from ._models_py3 import TaskUpdateParameters - from ._models_py3 import TimerTrigger - from ._models_py3 import TimerTriggerDescriptor - from ._models_py3 import TimerTriggerUpdateParameters - from ._models_py3 import TriggerProperties - from ._models_py3 import TriggerUpdateParameters - from ._models_py3 import UserIdentityProperties -except (SyntaxError, ImportError): - from ._models import AgentPool # type: ignore - from ._models import AgentPoolListResult # type: ignore - from ._models import AgentPoolQueueStatus # type: ignore - from ._models import AgentPoolUpdateParameters # type: ignore - from ._models import AgentProperties # type: ignore - from ._models import Argument # type: ignore - from ._models import AuthInfo # type: ignore - from ._models import AuthInfoUpdateParameters # type: ignore - from ._models import BaseImageDependency # type: ignore - from ._models import BaseImageTrigger # type: ignore - from ._models import BaseImageTriggerUpdateParameters # type: ignore - from ._models import Credentials # type: ignore - from ._models import CustomRegistryCredentials # type: ignore - from ._models import DockerBuildRequest # type: ignore - from ._models import DockerBuildStep # type: ignore - from ._models import DockerBuildStepUpdateParameters # type: ignore - from ._models import EncodedTaskRunRequest # type: ignore - from ._models import EncodedTaskStep # type: ignore - from ._models import EncodedTaskStepUpdateParameters # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import FileTaskRunRequest # type: ignore - from ._models import FileTaskStep # type: ignore - from ._models import FileTaskStepUpdateParameters # type: ignore - from ._models import IdentityProperties # type: ignore - from ._models import ImageDescriptor # type: ignore - from ._models import ImageUpdateTrigger # type: ignore - from ._models import InnerErrorDescription # type: ignore - from ._models import OverrideTaskStepProperties # type: ignore - from ._models import PlatformProperties # type: ignore - from ._models import PlatformUpdateParameters # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import Run # type: ignore - from ._models import RunFilter # type: ignore - from ._models import RunGetLogResult # type: ignore - from ._models import RunListResult # type: ignore - from ._models import RunRequest # type: ignore - from ._models import RunUpdateParameters # type: ignore - from ._models import SecretObject # type: ignore - from ._models import SetValue # type: ignore - from ._models import SourceProperties # type: ignore - from ._models import SourceRegistryCredentials # type: ignore - from ._models import SourceTrigger # type: ignore - from ._models import SourceTriggerDescriptor # type: ignore - from ._models import SourceTriggerUpdateParameters # type: ignore - from ._models import SourceUpdateParameters # type: ignore - from ._models import SourceUploadDefinition # type: ignore - from ._models import SystemData # type: ignore - from ._models import Task # type: ignore - from ._models import TaskListResult # type: ignore - from ._models import TaskRun # type: ignore - from ._models import TaskRunListResult # type: ignore - from ._models import TaskRunRequest # type: ignore - from ._models import TaskRunUpdateParameters # type: ignore - from ._models import TaskStepProperties # type: ignore - from ._models import TaskStepUpdateParameters # type: ignore - from ._models import TaskUpdateParameters # type: ignore - from ._models import TimerTrigger # type: ignore - from ._models import TimerTriggerDescriptor # type: ignore - from ._models import TimerTriggerUpdateParameters # type: ignore - from ._models import TriggerProperties # type: ignore - from ._models import TriggerUpdateParameters # type: ignore - from ._models import UserIdentityProperties # type: ignore +from ._models_py3 import AgentPool +from ._models_py3 import AgentPoolListResult +from ._models_py3 import AgentPoolQueueStatus +from ._models_py3 import AgentPoolUpdateParameters +from ._models_py3 import AgentProperties +from ._models_py3 import Argument +from ._models_py3 import AuthInfo +from ._models_py3 import AuthInfoUpdateParameters +from ._models_py3 import BaseImageDependency +from ._models_py3 import BaseImageTrigger +from ._models_py3 import BaseImageTriggerUpdateParameters +from ._models_py3 import Credentials +from ._models_py3 import CustomRegistryCredentials +from ._models_py3 import DockerBuildRequest +from ._models_py3 import DockerBuildStep +from ._models_py3 import DockerBuildStepUpdateParameters +from ._models_py3 import EncodedTaskRunRequest +from ._models_py3 import EncodedTaskStep +from ._models_py3 import EncodedTaskStepUpdateParameters +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import FileTaskRunRequest +from ._models_py3 import FileTaskStep +from ._models_py3 import FileTaskStepUpdateParameters +from ._models_py3 import IdentityProperties +from ._models_py3 import ImageDescriptor +from ._models_py3 import ImageUpdateTrigger +from ._models_py3 import InnerErrorDescription +from ._models_py3 import OverrideTaskStepProperties +from ._models_py3 import PlatformProperties +from ._models_py3 import PlatformUpdateParameters +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import Run +from ._models_py3 import RunFilter +from ._models_py3 import RunGetLogResult +from ._models_py3 import RunListResult +from ._models_py3 import RunRequest +from ._models_py3 import RunUpdateParameters +from ._models_py3 import SecretObject +from ._models_py3 import SetValue +from ._models_py3 import SourceProperties +from ._models_py3 import SourceRegistryCredentials +from ._models_py3 import SourceTrigger +from ._models_py3 import SourceTriggerDescriptor +from ._models_py3 import SourceTriggerUpdateParameters +from ._models_py3 import SourceUpdateParameters +from ._models_py3 import SourceUploadDefinition +from ._models_py3 import SystemData +from ._models_py3 import Task +from ._models_py3 import TaskListResult +from ._models_py3 import TaskRun +from ._models_py3 import TaskRunListResult +from ._models_py3 import TaskRunRequest +from ._models_py3 import TaskRunUpdateParameters +from ._models_py3 import TaskStepProperties +from ._models_py3 import TaskStepUpdateParameters +from ._models_py3 import TaskUpdateParameters +from ._models_py3 import TimerTrigger +from ._models_py3 import TimerTriggerDescriptor +from ._models_py3 import TimerTriggerUpdateParameters +from ._models_py3 import TriggerProperties +from ._models_py3 import TriggerUpdateParameters +from ._models_py3 import UserIdentityProperties + from ._container_registry_management_client_enums import ( Architecture, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_container_registry_management_client_enums.py index 59dd3f4f4d91..2f4e87bb0939 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_container_registry_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Architecture(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Architecture(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS architecture. """ @@ -36,21 +21,21 @@ class Architecture(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ARM = "arm" ARM64 = "arm64" -class BaseImageDependencyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageDependencyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the base image dependency. """ BUILD_TIME = "BuildTime" RUN_TIME = "RunTime" -class BaseImageTriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BaseImageTriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the auto trigger for base image dependency updates. """ ALL = "All" RUNTIME = "Runtime" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -59,7 +44,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -68,14 +53,14 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class OS(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OS(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The OS of agent machine """ WINDOWS = "Windows" LINUX = "Linux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of this agent pool """ @@ -86,7 +71,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -95,7 +80,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class RunStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RunStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the run. """ @@ -108,7 +93,7 @@ class RunStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" TIMEOUT = "Timeout" -class RunType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RunType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of run. """ @@ -117,7 +102,7 @@ class RunType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_BUILD = "AutoBuild" AUTO_RUN = "AutoRun" -class SecretObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretObjectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the secret object which determines how the value of the secret object has to be interpreted. """ @@ -125,14 +110,14 @@ class SecretObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OPAQUE = "Opaque" VAULTSECRET = "Vaultsecret" -class SourceControlType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceControlType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source control service. """ GITHUB = "Github" VISUAL_STUDIO_TEAM_SERVICE = "VisualStudioTeamService" -class SourceRegistryLoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceRegistryLoginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication mode which determines the source registry login scope. The credentials for the source registry will be generated using the given scope. These credentials will be used to login to @@ -142,12 +127,12 @@ class SourceRegistryLoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum NONE = "None" DEFAULT = "Default" -class SourceTriggerEvent(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceTriggerEvent(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COMMIT = "commit" PULLREQUEST = "pullrequest" -class StepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StepType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the step. """ @@ -155,35 +140,35 @@ class StepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_TASK = "FileTask" ENCODED_TASK = "EncodedTask" -class TaskStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TaskStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of task. """ DISABLED = "Disabled" ENABLED = "Enabled" -class TokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Auth token. """ PAT = "PAT" O_AUTH = "OAuth" -class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of trigger. """ DISABLED = "Disabled" ENABLED = "Enabled" -class UpdateTriggerPayloadType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateTriggerPayloadType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of Payload body for Base image update triggers. """ DEFAULT = "Default" TOKEN = "Token" -class Variant(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Variant(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Variant of the CPU. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py deleted file mode 100644 index 0ac9ce409ee8..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py +++ /dev/null @@ -1,2713 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.system_data = None - - -class AgentPool(Resource): - """The agentpool that has the ARM resource and properties. -The agentpool will have all information to create an agent pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param count: The count of agent machine. - :type count: int - :param tier: The Tier of agent machine. - :type tier: str - :param os: The OS of agent machine. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS - :param virtual_network_subnet_resource_id: The Virtual Network Subnet Resource Id of the agent - machine. - :type virtual_network_subnet_resource_id: str - :ivar provisioning_state: The provisioning state of this agent pool. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'tier': {'key': 'properties.tier', 'type': 'str'}, - 'os': {'key': 'properties.os', 'type': 'str'}, - 'virtual_network_subnet_resource_id': {'key': 'properties.virtualNetworkSubnetResourceId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentPool, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.tier = kwargs.get('tier', None) - self.os = kwargs.get('os', None) - self.virtual_network_subnet_resource_id = kwargs.get('virtual_network_subnet_resource_id', None) - self.provisioning_state = None - - -class AgentPoolListResult(msrest.serialization.Model): - """The collection of agent pools. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentPoolListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AgentPoolQueueStatus(msrest.serialization.Model): - """The QueueStatus of Agent Pool. - - :param count: The number of pending runs in the queue. - :type count: int - """ - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentPoolQueueStatus, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - - -class AgentPoolUpdateParameters(msrest.serialization.Model): - """The parameters for updating an agent pool. - - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param count: The count of agent machine. - :type count: int - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentPoolUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.count = kwargs.get('count', None) - - -class AgentProperties(msrest.serialization.Model): - """The properties that determine the run agent configuration. - - :param cpu: The CPU configuration in terms of number of cores required for the run. - :type cpu: int - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AgentProperties, self).__init__(**kwargs) - self.cpu = kwargs.get('cpu', None) - - -class Argument(msrest.serialization.Model): - """The properties of a run argument. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be - removed from build logs. - :type is_secret: bool - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'is_secret': {'key': 'isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Argument, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - self.is_secret = kwargs.get('is_secret', False) - - -class AuthInfo(msrest.serialization.Model): - """The authorization properties for accessing the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int - """ - - _validation = { - 'token_type': {'required': True}, - 'token': {'required': True}, - } - - _attribute_map = { - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AuthInfo, self).__init__(**kwargs) - self.token_type = kwargs['token_type'] - self.token = kwargs['token'] - self.refresh_token = kwargs.get('refresh_token', None) - self.scope = kwargs.get('scope', None) - self.expires_in = kwargs.get('expires_in', None) - - -class AuthInfoUpdateParameters(msrest.serialization.Model): - """The authorization properties for accessing the source code repository. - - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType - :param token: The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int - """ - - _attribute_map = { - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AuthInfoUpdateParameters, self).__init__(**kwargs) - self.token_type = kwargs.get('token_type', None) - self.token = kwargs.get('token', None) - self.refresh_token = kwargs.get('refresh_token', None) - self.scope = kwargs.get('scope', None) - self.expires_in = kwargs.get('expires_in', None) - - -class BaseImageDependency(msrest.serialization.Model): - """Properties that describe a base image dependency. - - :param type: The type of the base image dependency. Possible values include: "BuildTime", - "RunTime". - :type type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageDependency, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class BaseImageTrigger(msrest.serialization.Model): - """The trigger based on base image dependency. - - All required parameters must be populated in order to send to Azure. - - :param base_image_trigger_type: Required. The type of the auto trigger for base image - dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerType - :param update_trigger_endpoint: The endpoint URL for receiving update triggers. - :type update_trigger_endpoint: str - :param update_trigger_payload_type: Type of Payload body for Base image update triggers. - Possible values include: "Default", "Token". - :type update_trigger_payload_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UpdateTriggerPayloadType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'base_image_trigger_type': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'base_image_trigger_type': {'key': 'baseImageTriggerType', 'type': 'str'}, - 'update_trigger_endpoint': {'key': 'updateTriggerEndpoint', 'type': 'str'}, - 'update_trigger_payload_type': {'key': 'updateTriggerPayloadType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageTrigger, self).__init__(**kwargs) - self.base_image_trigger_type = kwargs['base_image_trigger_type'] - self.update_trigger_endpoint = kwargs.get('update_trigger_endpoint', None) - self.update_trigger_payload_type = kwargs.get('update_trigger_payload_type', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class BaseImageTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating base image dependency trigger. - - All required parameters must be populated in order to send to Azure. - - :param base_image_trigger_type: The type of the auto trigger for base image dependency updates. - Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerType - :param update_trigger_endpoint: The endpoint URL for receiving update triggers. - :type update_trigger_endpoint: str - :param update_trigger_payload_type: Type of Payload body for Base image update triggers. - Possible values include: "Default", "Token". - :type update_trigger_payload_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UpdateTriggerPayloadType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'base_image_trigger_type': {'key': 'baseImageTriggerType', 'type': 'str'}, - 'update_trigger_endpoint': {'key': 'updateTriggerEndpoint', 'type': 'str'}, - 'update_trigger_payload_type': {'key': 'updateTriggerPayloadType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BaseImageTriggerUpdateParameters, self).__init__(**kwargs) - self.base_image_trigger_type = kwargs.get('base_image_trigger_type', None) - self.update_trigger_endpoint = kwargs.get('update_trigger_endpoint', None) - self.update_trigger_payload_type = kwargs.get('update_trigger_payload_type', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class Credentials(msrest.serialization.Model): - """The parameters that describes a set of credentials that will be used when a run is invoked. - - :param source_registry: Describes the credential parameters for accessing the source registry. - :type source_registry: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceRegistryCredentials - :param custom_registries: Describes the credential parameters for accessing other custom - registries. The key - for the dictionary item will be the registry login server (myregistry.azurecr.io) and - the value of the item will be the registry credentials for accessing the registry. - :type custom_registries: dict[str, - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.CustomRegistryCredentials] - """ - - _attribute_map = { - 'source_registry': {'key': 'sourceRegistry', 'type': 'SourceRegistryCredentials'}, - 'custom_registries': {'key': 'customRegistries', 'type': '{CustomRegistryCredentials}'}, - } - - def __init__( - self, - **kwargs - ): - super(Credentials, self).__init__(**kwargs) - self.source_registry = kwargs.get('source_registry', None) - self.custom_registries = kwargs.get('custom_registries', None) - - -class CustomRegistryCredentials(msrest.serialization.Model): - """Describes the credentials that will be used to access a custom registry during a run. - - :param user_name: The username for logging into the custom registry. - :type user_name: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject - :param password: The password for logging into the custom registry. The password is a secret - object that allows multiple ways of providing the value for it. - :type password: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject - :param identity: Indicates the managed identity assigned to the custom credential. If a - user-assigned identity - this value is the Client ID. If a system-assigned identity, the value will be ``system``. In - the case of a system-assigned identity, the Client ID will be determined by the runner. This - identity may be used to authenticate to key vault to retrieve credentials or it may be the - only - source of authentication used for accessing the registry. - :type identity: str - """ - - _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'SecretObject'}, - 'password': {'key': 'password', 'type': 'SecretObject'}, - 'identity': {'key': 'identity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomRegistryCredentials, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.password = kwargs.get('password', None) - self.identity = kwargs.get('identity', None) - - -class RunRequest(msrest.serialization.Model): - """The request parameters for scheduling a run. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildRequest, EncodedTaskRunRequest, FileTaskRunRequest, TaskRunRequest. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log - artifact. - :type log_template: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'agent_pool_name': {'key': 'agentPoolName', 'type': 'str'}, - 'log_template': {'key': 'logTemplate', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'DockerBuildRequest': 'DockerBuildRequest', 'EncodedTaskRunRequest': 'EncodedTaskRunRequest', 'FileTaskRunRequest': 'FileTaskRunRequest', 'TaskRunRequest': 'TaskRunRequest'} - } - - def __init__( - self, - **kwargs - ): - super(RunRequest, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.is_archive_enabled = kwargs.get('is_archive_enabled', False) - self.agent_pool_name = kwargs.get('agent_pool_name', None) - self.log_template = kwargs.get('log_template', None) - - -class DockerBuildRequest(RunRequest): - """The parameters for a docker quick build. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log - artifact. - :type log_template: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing the run. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials - """ - - _validation = { - 'type': {'required': True}, - 'docker_file_path': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'agent_pool_name': {'key': 'agentPoolName', 'type': 'str'}, - 'log_template': {'key': 'logTemplate', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildRequest, self).__init__(**kwargs) - self.type = 'DockerBuildRequest' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.docker_file_path = kwargs['docker_file_path'] - self.target = kwargs.get('target', None) - self.arguments = kwargs.get('arguments', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class TaskStepProperties(msrest.serialization.Model): - """Base properties for any task step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStep, EncodedTaskStep, FileTaskStep. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStep', 'EncodedTask': 'EncodedTaskStep', 'FileTask': 'FileTaskStep'} - } - - def __init__( - self, - **kwargs - ): - super(TaskStepProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.base_image_dependencies = None - self.context_path = kwargs.get('context_path', None) - self.context_access_token = kwargs.get('context_access_token', None) - - -class DockerBuildStep(TaskStepProperties): - """The Docker build step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source context. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing this build - step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - 'docker_file_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStep, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', True) - self.no_cache = kwargs.get('no_cache', False) - self.docker_file_path = kwargs['docker_file_path'] - self.target = kwargs.get('target', None) - self.arguments = kwargs.get('arguments', None) - - -class TaskStepUpdateParameters(msrest.serialization.Model): - """Base properties for updating any task step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DockerBuildStepUpdateParameters, EncodedTaskStepUpdateParameters, FileTaskStepUpdateParameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Docker': 'DockerBuildStepUpdateParameters', 'EncodedTask': 'EncodedTaskStepUpdateParameters', 'FileTask': 'FileTaskStepUpdateParameters'} - } - - def __init__( - self, - **kwargs - ): - super(TaskStepUpdateParameters, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.context_path = kwargs.get('context_path', None) - self.context_access_token = kwargs.get('context_access_token', None) - - -class DockerBuildStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating a docker build step. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source context. - :type docker_file_path: str - :param arguments: The collection of override arguments to be used when executing this build - step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'image_names': {'key': 'imageNames', 'type': '[str]'}, - 'is_push_enabled': {'key': 'isPushEnabled', 'type': 'bool'}, - 'no_cache': {'key': 'noCache', 'type': 'bool'}, - 'docker_file_path': {'key': 'dockerFilePath', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DockerBuildStepUpdateParameters, self).__init__(**kwargs) - self.type = 'Docker' # type: str - self.image_names = kwargs.get('image_names', None) - self.is_push_enabled = kwargs.get('is_push_enabled', None) - self.no_cache = kwargs.get('no_cache', None) - self.docker_file_path = kwargs.get('docker_file_path', None) - self.arguments = kwargs.get('arguments', None) - self.target = kwargs.get('target', None) - - -class EncodedTaskRunRequest(RunRequest): - """The parameters for a quick task run request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log - artifact. - :type log_template: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file - content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials - """ - - _validation = { - 'type': {'required': True}, - 'encoded_task_content': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'agent_pool_name': {'key': 'agentPoolName', 'type': 'str'}, - 'log_template': {'key': 'logTemplate', 'type': 'str'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskRunRequest, self).__init__(**kwargs) - self.type = 'EncodedTaskRunRequest' # type: str - self.encoded_task_content = kwargs['encoded_task_content'] - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class EncodedTaskStep(TaskStepProperties): - """The properties of a encoded task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file - content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - 'encoded_task_content': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskStep, self).__init__(**kwargs) - self.type = 'EncodedTask' # type: str - self.encoded_task_content = kwargs['encoded_task_content'] - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - - -class EncodedTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating encoded task step. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'encoded_task_content': {'key': 'encodedTaskContent', 'type': 'str'}, - 'encoded_values_content': {'key': 'encodedValuesContent', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(EncodedTaskStepUpdateParameters, self).__init__(**kwargs) - self.type = 'EncodedTask' # type: str - self.encoded_task_content = kwargs.get('encoded_task_content', None) - self.encoded_values_content = kwargs.get('encoded_values_content', None) - self.values = kwargs.get('values', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this - contract. - :type details: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.InnerErrorDescription - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class FileTaskRunRequest(RunRequest): - """The request parameters for a scheduling run against a task file. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log - artifact. - :type log_template: str - :param task_file_path: Required. The template/definition file path relative to the source. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. - If it is relative URL, the relative path should be obtained from calling - listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials - """ - - _validation = { - 'type': {'required': True}, - 'task_file_path': {'required': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - 'platform': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'agent_pool_name': {'key': 'agentPoolName', 'type': 'str'}, - 'log_template': {'key': 'logTemplate', 'type': 'str'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - 'timeout': {'key': 'timeout', 'type': 'int'}, - 'platform': {'key': 'platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'agentConfiguration', 'type': 'AgentProperties'}, - 'source_location': {'key': 'sourceLocation', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'Credentials'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskRunRequest, self).__init__(**kwargs) - self.type = 'FileTaskRunRequest' # type: str - self.task_file_path = kwargs['task_file_path'] - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - self.timeout = kwargs.get('timeout', 3600) - self.platform = kwargs['platform'] - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_location = kwargs.get('source_location', None) - self.credentials = kwargs.get('credentials', None) - - -class FileTaskStep(TaskStepProperties): - """The properties of a task step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: Required. The task template/definition file path relative to the source - context. - :type task_file_path: str - :param values_file_path: The task values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - 'base_image_dependencies': {'readonly': True}, - 'task_file_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'base_image_dependencies': {'key': 'baseImageDependencies', 'type': '[BaseImageDependency]'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskStep, self).__init__(**kwargs) - self.type = 'FileTask' # type: str - self.task_file_path = kwargs['task_file_path'] - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - - -class FileTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties of updating a task step. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'context_access_token': {'key': 'contextAccessToken', 'type': 'str'}, - 'task_file_path': {'key': 'taskFilePath', 'type': 'str'}, - 'values_file_path': {'key': 'valuesFilePath', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(FileTaskStepUpdateParameters, self).__init__(**kwargs) - self.type = 'FileTask' # type: str - self.task_file_path = kwargs.get('task_file_path', None) - self.values_file_path = kwargs.get('values_file_path', None) - self.values = kwargs.get('values', None) - - -class IdentityProperties(msrest.serialization.Model): - """Managed identity for the resource. - - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", "None". - :type type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity - dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UserIdentityProperties] - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImageDescriptor(msrest.serialization.Model): - """Properties for a registry image. - - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str - """ - - _attribute_map = { - 'registry': {'key': 'registry', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageDescriptor, self).__init__(**kwargs) - self.registry = kwargs.get('registry', None) - self.repository = kwargs.get('repository', None) - self.tag = kwargs.get('tag', None) - self.digest = kwargs.get('digest', None) - - -class ImageUpdateTrigger(msrest.serialization.Model): - """The image update trigger that caused a build. - - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'images': {'key': 'images', 'type': '[ImageDescriptor]'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageUpdateTrigger, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.images = kwargs.get('images', None) - - -class InnerErrorDescription(msrest.serialization.Model): - """inner error. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InnerErrorDescription, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - - -class OverrideTaskStepProperties(msrest.serialization.Model): - """OverrideTaskStepProperties. - - :param context_path: The source context against which run has to be queued. - :type context_path: str - :param file: The file against which run has to be queued. - :type file: str - :param arguments: Gets or sets the collection of override arguments to be used when - executing a build step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str - :param values: The collection of overridable values that can be passed when running a Task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - :param update_trigger_token: Base64 encoded update trigger token that will be attached with the - base image trigger webhook. - :type update_trigger_token: str - """ - - _attribute_map = { - 'context_path': {'key': 'contextPath', 'type': 'str'}, - 'file': {'key': 'file', 'type': 'str'}, - 'arguments': {'key': 'arguments', 'type': '[Argument]'}, - 'target': {'key': 'target', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[SetValue]'}, - 'update_trigger_token': {'key': 'updateTriggerToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OverrideTaskStepProperties, self).__init__(**kwargs) - self.context_path = kwargs.get('context_path', None) - self.file = kwargs.get('file', None) - self.arguments = kwargs.get('arguments', None) - self.target = kwargs.get('target', None) - self.values = kwargs.get('values', None) - self.update_trigger_token = kwargs.get('update_trigger_token', None) - - -class PlatformProperties(msrest.serialization.Model): - """The platform properties against which the run has to happen. - - All required parameters must be populated in order to send to Azure. - - :param os: Required. The operating system type required for the run. Possible values include: - "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "386", - "arm", "arm64". - :type architecture: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant - """ - - _validation = { - 'os': {'required': True}, - } - - _attribute_map = { - 'os': {'key': 'os', 'type': 'str'}, - 'architecture': {'key': 'architecture', 'type': 'str'}, - 'variant': {'key': 'variant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PlatformProperties, self).__init__(**kwargs) - self.os = kwargs['os'] - self.architecture = kwargs.get('architecture', None) - self.variant = kwargs.get('variant', None) - - -class PlatformUpdateParameters(msrest.serialization.Model): - """The properties for updating the platform configuration. - - :param os: The operating system type required for the run. Possible values include: "Windows", - "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "386", - "arm", "arm64". - :type architecture: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant - """ - - _attribute_map = { - 'os': {'key': 'os', 'type': 'str'}, - 'architecture': {'key': 'architecture', 'type': 'str'}, - 'variant': {'key': 'variant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PlatformUpdateParameters, self).__init__(**kwargs) - self.os = kwargs.get('os', None) - self.architecture = kwargs.get('architecture', None) - self.variant = kwargs.get('variant', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class Run(ProxyResource): - """Run resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param run_id: The unique identifier for the run. - :type run_id: str - :param status: The current status of the run. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus - :param last_updated_time: The last updated time for the run. - :type last_updated_time: ~datetime.datetime - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", - "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param create_time: The time the run was scheduled. - :type create_time: ~datetime.datetime - :param start_time: The time the run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the run. This is - applicable if the run generates base image dependencies. - :type output_images: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor] - :param task: The task against which run was scheduled. - :type task: str - :param image_update_trigger: The image update trigger that caused the run. This is applicable - if the task has base image trigger configured. - :type image_update_trigger: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageUpdateTrigger - :param source_trigger: The source trigger that caused the run. - :type source_trigger: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerDescriptor - :param timer_trigger: The timer trigger that caused the run. - :type timer_trigger: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTriggerDescriptor - :param platform: The platform properties against which the run will happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_registry_auth: The scope of the credentials that were used to login to the source - registry during this run. - :type source_registry_auth: str - :param custom_registries: The list of custom registries that were logged in during this run. - :type custom_registries: list[str] - :ivar run_error_message: The error message received from backend systems after the run is - scheduled. - :vartype run_error_message: str - :param update_trigger_token: The update trigger token passed for the Run. - :type update_trigger_token: str - :ivar log_artifact: The image description for the log artifact. - :vartype log_artifact: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor - :param provisioning_state: The provisioning state of a run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'run_error_message': {'readonly': True}, - 'log_artifact': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'run_id': {'key': 'properties.runId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, - 'run_type': {'key': 'properties.runType', 'type': 'str'}, - 'agent_pool_name': {'key': 'properties.agentPoolName', 'type': 'str'}, - 'create_time': {'key': 'properties.createTime', 'type': 'iso-8601'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'properties.finishTime', 'type': 'iso-8601'}, - 'output_images': {'key': 'properties.outputImages', 'type': '[ImageDescriptor]'}, - 'task': {'key': 'properties.task', 'type': 'str'}, - 'image_update_trigger': {'key': 'properties.imageUpdateTrigger', 'type': 'ImageUpdateTrigger'}, - 'source_trigger': {'key': 'properties.sourceTrigger', 'type': 'SourceTriggerDescriptor'}, - 'timer_trigger': {'key': 'properties.timerTrigger', 'type': 'TimerTriggerDescriptor'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'source_registry_auth': {'key': 'properties.sourceRegistryAuth', 'type': 'str'}, - 'custom_registries': {'key': 'properties.customRegistries', 'type': '[str]'}, - 'run_error_message': {'key': 'properties.runErrorMessage', 'type': 'str'}, - 'update_trigger_token': {'key': 'properties.updateTriggerToken', 'type': 'str'}, - 'log_artifact': {'key': 'properties.logArtifact', 'type': 'ImageDescriptor'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'is_archive_enabled': {'key': 'properties.isArchiveEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Run, self).__init__(**kwargs) - self.run_id = kwargs.get('run_id', None) - self.status = kwargs.get('status', None) - self.last_updated_time = kwargs.get('last_updated_time', None) - self.run_type = kwargs.get('run_type', None) - self.agent_pool_name = kwargs.get('agent_pool_name', None) - self.create_time = kwargs.get('create_time', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_images = kwargs.get('output_images', None) - self.task = kwargs.get('task', None) - self.image_update_trigger = kwargs.get('image_update_trigger', None) - self.source_trigger = kwargs.get('source_trigger', None) - self.timer_trigger = kwargs.get('timer_trigger', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.source_registry_auth = kwargs.get('source_registry_auth', None) - self.custom_registries = kwargs.get('custom_registries', None) - self.run_error_message = None - self.update_trigger_token = kwargs.get('update_trigger_token', None) - self.log_artifact = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', False) - - -class RunFilter(msrest.serialization.Model): - """Properties that are enabled for Odata querying on runs. - - :param run_id: The unique identifier for the run. - :type run_id: str - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", - "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType - :param status: The current status of the run. Possible values include: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus - :param create_time: The create time for a run. - :type create_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated - from the run. This is applicable if the run is of - build type. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param task_name: The name of the task that the run corresponds to. - :type task_name: str - :param agent_pool_name: The name of the agent pool that the run corresponds to. - :type agent_pool_name: str - """ - - _attribute_map = { - 'run_id': {'key': 'runId', 'type': 'str'}, - 'run_type': {'key': 'runType', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'create_time': {'key': 'createTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'output_image_manifests': {'key': 'outputImageManifests', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'task_name': {'key': 'taskName', 'type': 'str'}, - 'agent_pool_name': {'key': 'agentPoolName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunFilter, self).__init__(**kwargs) - self.run_id = kwargs.get('run_id', None) - self.run_type = kwargs.get('run_type', None) - self.status = kwargs.get('status', None) - self.create_time = kwargs.get('create_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.output_image_manifests = kwargs.get('output_image_manifests', None) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - self.task_name = kwargs.get('task_name', None) - self.agent_pool_name = kwargs.get('agent_pool_name', None) - - -class RunGetLogResult(msrest.serialization.Model): - """The result of get log link operation. - - :param log_link: The link to logs for a run on a azure container registry. - :type log_link: str - :param log_artifact_link: The link to logs in registry for a run on a azure container registry. - :type log_artifact_link: str - """ - - _attribute_map = { - 'log_link': {'key': 'logLink', 'type': 'str'}, - 'log_artifact_link': {'key': 'logArtifactLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunGetLogResult, self).__init__(**kwargs) - self.log_link = kwargs.get('log_link', None) - self.log_artifact_link = kwargs.get('log_artifact_link', None) - - -class RunListResult(msrest.serialization.Model): - """Collection of runs. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Run]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RunUpdateParameters(msrest.serialization.Model): - """The set of run properties that can be updated. - - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - """ - - _attribute_map = { - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RunUpdateParameters, self).__init__(**kwargs) - self.is_archive_enabled = kwargs.get('is_archive_enabled', None) - - -class SecretObject(msrest.serialization.Model): - """Describes the properties of a secret object value. - - :param value: The value of the secret. The format of this value will be determined - based on the type of the secret object. If the type is Opaque, the value will be - used as is without any modification. - :type value: str - :param type: The type of the secret object which determines how the value of the secret object - has to be - interpreted. Possible values include: "Opaque", "Vaultsecret". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObjectType - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretObject, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.type = kwargs.get('type', None) - - -class SetValue(msrest.serialization.Model): - """The properties of a overridable value that can be passed to a task template. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the overridable value. - :type name: str - :param value: Required. The overridable value. - :type value: str - :param is_secret: Flag to indicate whether the value represents a secret or not. - :type is_secret: bool - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'is_secret': {'key': 'isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SetValue, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - self.is_secret = kwargs.get('is_secret', False) - - -class SourceProperties(msrest.serialization.Model): - """The properties of the source code repository. - - All required parameters must be populated in order to send to Azure. - - :param source_control_type: Required. The type of source control service. Possible values - include: "Github", "VisualStudioTeamService". - :type source_control_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source - code repository and to set up - webhooks for notifications. - :type source_control_auth_properties: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AuthInfo - """ - - _validation = { - 'source_control_type': {'required': True}, - 'repository_url': {'required': True}, - } - - _attribute_map = { - 'source_control_type': {'key': 'sourceControlType', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'AuthInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceProperties, self).__init__(**kwargs) - self.source_control_type = kwargs['source_control_type'] - self.repository_url = kwargs['repository_url'] - self.branch = kwargs.get('branch', None) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - - -class SourceRegistryCredentials(msrest.serialization.Model): - """Describes the credential parameters for accessing the source registry. - - :param login_mode: The authentication mode which determines the source registry login scope. - The credentials for the source registry - will be generated using the given scope. These credentials will be used to login to - the source registry during the run. Possible values include: "None", "Default". - :type login_mode: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceRegistryLoginMode - """ - - _attribute_map = { - 'login_mode': {'key': 'loginMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceRegistryCredentials, self).__init__(**kwargs) - self.login_mode = kwargs.get('login_mode', None) - - -class SourceTrigger(msrest.serialization.Model): - """The properties of a source based trigger. - - All required parameters must be populated in order to send to Azure. - - :param source_repository: Required. The properties that describes the source(code) for the - task. - :type source_repository: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceProperties - :param source_trigger_events: Required. The source event corresponding to the trigger. - :type source_trigger_events: list[str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'source_repository': {'required': True}, - 'source_trigger_events': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'source_repository': {'key': 'sourceRepository', 'type': 'SourceProperties'}, - 'source_trigger_events': {'key': 'sourceTriggerEvents', 'type': '[str]'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTrigger, self).__init__(**kwargs) - self.source_repository = kwargs['source_repository'] - self.source_trigger_events = kwargs['source_trigger_events'] - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class SourceTriggerDescriptor(msrest.serialization.Model): - """The source trigger that caused a run. - - :param id: The unique ID of the trigger. - :type id: str - :param event_type: The event type of the trigger. - :type event_type: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param pull_request_id: The unique ID that identifies pull request. - :type pull_request_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_type': {'key': 'eventType', 'type': 'str'}, - 'commit_id': {'key': 'commitId', 'type': 'str'}, - 'pull_request_id': {'key': 'pullRequestId', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch_name': {'key': 'branchName', 'type': 'str'}, - 'provider_type': {'key': 'providerType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTriggerDescriptor, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.event_type = kwargs.get('event_type', None) - self.commit_id = kwargs.get('commit_id', None) - self.pull_request_id = kwargs.get('pull_request_id', None) - self.repository_url = kwargs.get('repository_url', None) - self.branch_name = kwargs.get('branch_name', None) - self.provider_type = kwargs.get('provider_type', None) - - -class SourceTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating a source based trigger. - - All required parameters must be populated in order to send to Azure. - - :param source_repository: The properties that describes the source(code) for the task. - :type source_repository: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceUpdateParameters - :param source_trigger_events: The source event corresponding to the trigger. - :type source_trigger_events: list[str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'source_repository': {'key': 'sourceRepository', 'type': 'SourceUpdateParameters'}, - 'source_trigger_events': {'key': 'sourceTriggerEvents', 'type': '[str]'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceTriggerUpdateParameters, self).__init__(**kwargs) - self.source_repository = kwargs.get('source_repository', None) - self.source_trigger_events = kwargs.get('source_trigger_events', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class SourceUpdateParameters(msrest.serialization.Model): - """The properties for updating the source code repository. - - :param source_control_type: The type of source control service. Possible values include: - "Github", "VisualStudioTeamService". - :type source_control_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceControlType - :param repository_url: The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source - code repository and to set up - webhooks for notifications. - :type source_control_auth_properties: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AuthInfoUpdateParameters - """ - - _attribute_map = { - 'source_control_type': {'key': 'sourceControlType', 'type': 'str'}, - 'repository_url': {'key': 'repositoryUrl', 'type': 'str'}, - 'branch': {'key': 'branch', 'type': 'str'}, - 'source_control_auth_properties': {'key': 'sourceControlAuthProperties', 'type': 'AuthInfoUpdateParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceUpdateParameters, self).__init__(**kwargs) - self.source_control_type = kwargs.get('source_control_type', None) - self.repository_url = kwargs.get('repository_url', None) - self.branch = kwargs.get('branch', None) - self.source_control_auth_properties = kwargs.get('source_control_auth_properties', None) - - -class SourceUploadDefinition(msrest.serialization.Model): - """The properties of a response to source upload request. - - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent - queue build request. - :type relative_path: str - """ - - _attribute_map = { - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceUploadDefinition, self).__init__(**kwargs) - self.upload_url = kwargs.get('upload_url', None) - self.relative_path = kwargs.get('relative_path', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Task(Resource): - """The task that has the ARM resource and task properties. -The task will have all information to schedule a run against it. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties - :ivar provisioning_state: The provisioning state of the task. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState - :ivar creation_date: The creation date of task. - :vartype creation_date: ~datetime.datetime - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param agent_pool_name: The dedicated agent pool for the task. - :type agent_pool_name: str - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties of a task step. - :type step: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepProperties - :param trigger: The properties that describe all triggers for the task. - :type trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerProperties - :param credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials - :param log_template: The template that describes the repository and tag information for run log - artifact. - :type log_template: str - :param is_system_task: The value of this property indicates whether the task resource is system - task or not. - :type is_system_task: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'timeout': {'maximum': 28800, 'minimum': 300}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformProperties'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'agent_pool_name': {'key': 'properties.agentPoolName', 'type': 'str'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - 'step': {'key': 'properties.step', 'type': 'TaskStepProperties'}, - 'trigger': {'key': 'properties.trigger', 'type': 'TriggerProperties'}, - 'credentials': {'key': 'properties.credentials', 'type': 'Credentials'}, - 'log_template': {'key': 'properties.logTemplate', 'type': 'str'}, - 'is_system_task': {'key': 'properties.isSystemTask', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Task, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.creation_date = None - self.status = kwargs.get('status', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.agent_pool_name = kwargs.get('agent_pool_name', None) - self.timeout = kwargs.get('timeout', 3600) - self.step = kwargs.get('step', None) - self.trigger = kwargs.get('trigger', None) - self.credentials = kwargs.get('credentials', None) - self.log_template = kwargs.get('log_template', None) - self.is_system_task = kwargs.get('is_system_task', False) - - -class TaskListResult(msrest.serialization.Model): - """The collection of tasks. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Task]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TaskRun(ProxyResource): - """The task run that has the ARM resource and properties. -The task run will have the information of request and result of a run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties - :param location: The location of the resource. - :type location: str - :ivar provisioning_state: The provisioning state of this task run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState - :param run_request: The request (parameters) for the run. - :type run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest - :ivar run_result: The result of this task run. - :vartype run_result: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run - :param force_update_tag: How the run should be forced to rerun even if the run request - configuration has not changed. - :type force_update_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'run_result': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'run_request': {'key': 'properties.runRequest', 'type': 'RunRequest'}, - 'run_result': {'key': 'properties.runResult', 'type': 'Run'}, - 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskRun, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.location = kwargs.get('location', None) - self.provisioning_state = None - self.run_request = kwargs.get('run_request', None) - self.run_result = None - self.force_update_tag = kwargs.get('force_update_tag', None) - - -class TaskRunListResult(msrest.serialization.Model): - """The collection of task runs. - - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TaskRun]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskRunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TaskRunRequest(RunRequest): - """The parameters for a task run request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log - artifact. - :type log_template: str - :param task_id: Required. The resource ID of task against which run has to be queued. - :type task_id: str - :param override_task_step_properties: Set of overridable parameters that can be passed when - running a Task. - :type override_task_step_properties: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OverrideTaskStepProperties - """ - - _validation = { - 'type': {'required': True}, - 'task_id': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'agent_pool_name': {'key': 'agentPoolName', 'type': 'str'}, - 'log_template': {'key': 'logTemplate', 'type': 'str'}, - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'override_task_step_properties': {'key': 'overrideTaskStepProperties', 'type': 'OverrideTaskStepProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskRunRequest, self).__init__(**kwargs) - self.type = 'TaskRunRequest' # type: str - self.task_id = kwargs['task_id'] - self.override_task_step_properties = kwargs.get('override_task_step_properties', None) - - -class TaskRunUpdateParameters(msrest.serialization.Model): - """The parameters for updating a task run. - - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param run_request: The request (parameters) for the new run. - :type run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest - :param force_update_tag: How the run should be forced to rerun even if the run request - configuration has not changed. - :type force_update_tag: str - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'run_request': {'key': 'properties.runRequest', 'type': 'RunRequest'}, - 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskRunUpdateParameters, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.run_request = kwargs.get('run_request', None) - self.force_update_tag = kwargs.get('force_update_tag', None) - - -class TaskUpdateParameters(msrest.serialization.Model): - """The parameters for updating a task. - - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformUpdateParameters - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param agent_pool_name: The dedicated agent pool for the task. - :type agent_pool_name: str - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties for updating a task step. - :type step: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepUpdateParameters - :param trigger: The properties for updating trigger properties. - :type trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerUpdateParameters - :param credentials: The parameters that describes a set of credentials that will be used when - this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials - :param log_template: The template that describes the repository and tag information for run log - artifact. - :type log_template: str - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'platform': {'key': 'properties.platform', 'type': 'PlatformUpdateParameters'}, - 'agent_configuration': {'key': 'properties.agentConfiguration', 'type': 'AgentProperties'}, - 'agent_pool_name': {'key': 'properties.agentPoolName', 'type': 'str'}, - 'timeout': {'key': 'properties.timeout', 'type': 'int'}, - 'step': {'key': 'properties.step', 'type': 'TaskStepUpdateParameters'}, - 'trigger': {'key': 'properties.trigger', 'type': 'TriggerUpdateParameters'}, - 'credentials': {'key': 'properties.credentials', 'type': 'Credentials'}, - 'log_template': {'key': 'properties.logTemplate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskUpdateParameters, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - self.status = kwargs.get('status', None) - self.platform = kwargs.get('platform', None) - self.agent_configuration = kwargs.get('agent_configuration', None) - self.agent_pool_name = kwargs.get('agent_pool_name', None) - self.timeout = kwargs.get('timeout', None) - self.step = kwargs.get('step', None) - self.trigger = kwargs.get('trigger', None) - self.credentials = kwargs.get('credentials', None) - self.log_template = kwargs.get('log_template', None) - - -class TimerTrigger(msrest.serialization.Model): - """The properties of a timer trigger. - - All required parameters must be populated in order to send to Azure. - - :param schedule: Required. The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'schedule': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TimerTrigger, self).__init__(**kwargs) - self.schedule = kwargs['schedule'] - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class TimerTriggerDescriptor(msrest.serialization.Model): - """TimerTriggerDescriptor. - - :param timer_trigger_name: The timer trigger name that caused the run. - :type timer_trigger_name: str - :param schedule_occurrence: The occurrence that triggered the run. - :type schedule_occurrence: str - """ - - _attribute_map = { - 'timer_trigger_name': {'key': 'timerTriggerName', 'type': 'str'}, - 'schedule_occurrence': {'key': 'scheduleOccurrence', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TimerTriggerDescriptor, self).__init__(**kwargs) - self.timer_trigger_name = kwargs.get('timer_trigger_name', None) - self.schedule_occurrence = kwargs.get('schedule_occurrence', None) - - -class TimerTriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating a timer trigger. - - All required parameters must be populated in order to send to Azure. - - :param schedule: The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TimerTriggerUpdateParameters, self).__init__(**kwargs) - self.schedule = kwargs.get('schedule', None) - self.status = kwargs.get('status', None) - self.name = kwargs['name'] - - -class TriggerProperties(msrest.serialization.Model): - """The properties of a trigger. - - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTrigger] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTrigger] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTrigger - """ - - _attribute_map = { - 'timer_triggers': {'key': 'timerTriggers', 'type': '[TimerTrigger]'}, - 'source_triggers': {'key': 'sourceTriggers', 'type': '[SourceTrigger]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'BaseImageTrigger'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerProperties, self).__init__(**kwargs) - self.timer_triggers = kwargs.get('timer_triggers', None) - self.source_triggers = kwargs.get('source_triggers', None) - self.base_image_trigger = kwargs.get('base_image_trigger', None) - - -class TriggerUpdateParameters(msrest.serialization.Model): - """The properties for updating triggers. - - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTriggerUpdateParameters] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: - list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerUpdateParameters] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: - ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerUpdateParameters - """ - - _attribute_map = { - 'timer_triggers': {'key': 'timerTriggers', 'type': '[TimerTriggerUpdateParameters]'}, - 'source_triggers': {'key': 'sourceTriggers', 'type': '[SourceTriggerUpdateParameters]'}, - 'base_image_trigger': {'key': 'baseImageTrigger', 'type': 'BaseImageTriggerUpdateParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerUpdateParameters, self).__init__(**kwargs) - self.timer_triggers = kwargs.get('timer_triggers', None) - self.source_triggers = kwargs.get('source_triggers', None) - self.base_image_trigger = kwargs.get('base_image_trigger', None) - - -class UserIdentityProperties(msrest.serialization.Model): - """UserIdentityProperties. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py index 64c611f02d2e..98be0e88d745 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py @@ -28,11 +28,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData """ @@ -61,6 +61,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -84,22 +91,22 @@ class AgentPool(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param count: The count of agent machine. - :type count: int - :param tier: The Tier of agent machine. - :type tier: str - :param os: The OS of agent machine. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS - :param virtual_network_subnet_resource_id: The Virtual Network Subnet Resource Id of the agent + :ivar count: The count of agent machine. + :vartype count: int + :ivar tier: The Tier of agent machine. + :vartype tier: str + :ivar os: The OS of agent machine. Possible values include: "Windows", "Linux". + :vartype os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS + :ivar virtual_network_subnet_resource_id: The Virtual Network Subnet Resource Id of the agent machine. - :type virtual_network_subnet_resource_id: str + :vartype virtual_network_subnet_resource_id: str :ivar provisioning_state: The provisioning state of this agent pool. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or @@ -140,6 +147,22 @@ def __init__( virtual_network_subnet_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword count: The count of agent machine. + :paramtype count: int + :keyword tier: The Tier of agent machine. + :paramtype tier: str + :keyword os: The OS of agent machine. Possible values include: "Windows", "Linux". + :paramtype os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS + :keyword virtual_network_subnet_resource_id: The Virtual Network Subnet Resource Id of the + agent machine. + :paramtype virtual_network_subnet_resource_id: str + """ super(AgentPool, self).__init__(location=location, tags=tags, **kwargs) self.count = count self.tier = tier @@ -151,10 +174,10 @@ def __init__( class AgentPoolListResult(msrest.serialization.Model): """The collection of agent pools. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -169,6 +192,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(AgentPoolListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -177,8 +206,8 @@ def __init__( class AgentPoolQueueStatus(msrest.serialization.Model): """The QueueStatus of Agent Pool. - :param count: The number of pending runs in the queue. - :type count: int + :ivar count: The number of pending runs in the queue. + :vartype count: int """ _attribute_map = { @@ -191,6 +220,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: The number of pending runs in the queue. + :paramtype count: int + """ super(AgentPoolQueueStatus, self).__init__(**kwargs) self.count = count @@ -198,10 +231,10 @@ def __init__( class AgentPoolUpdateParameters(msrest.serialization.Model): """The parameters for updating an agent pool. - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param count: The count of agent machine. - :type count: int + :ivar tags: A set of tags. The ARM resource tags. + :vartype tags: dict[str, str] + :ivar count: The count of agent machine. + :vartype count: int """ _attribute_map = { @@ -216,6 +249,12 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword tags: A set of tags. The ARM resource tags. + :paramtype tags: dict[str, str] + :keyword count: The count of agent machine. + :paramtype count: int + """ super(AgentPoolUpdateParameters, self).__init__(**kwargs) self.tags = tags self.count = count @@ -224,8 +263,8 @@ def __init__( class AgentProperties(msrest.serialization.Model): """The properties that determine the run agent configuration. - :param cpu: The CPU configuration in terms of number of cores required for the run. - :type cpu: int + :ivar cpu: The CPU configuration in terms of number of cores required for the run. + :vartype cpu: int """ _attribute_map = { @@ -238,6 +277,10 @@ def __init__( cpu: Optional[int] = None, **kwargs ): + """ + :keyword cpu: The CPU configuration in terms of number of cores required for the run. + :paramtype cpu: int + """ super(AgentProperties, self).__init__(**kwargs) self.cpu = cpu @@ -247,13 +290,13 @@ class Argument(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the argument. - :type name: str - :param value: Required. The value of the argument. - :type value: str - :param is_secret: Flag to indicate whether the argument represents a secret and want to be + :ivar name: Required. The name of the argument. + :vartype name: str + :ivar value: Required. The value of the argument. + :vartype value: str + :ivar is_secret: Flag to indicate whether the argument represents a secret and want to be removed from build logs. - :type is_secret: bool + :vartype is_secret: bool """ _validation = { @@ -275,6 +318,15 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The name of the argument. + :paramtype name: str + :keyword value: Required. The value of the argument. + :paramtype value: str + :keyword is_secret: Flag to indicate whether the argument represents a secret and want to be + removed from build logs. + :paramtype is_secret: bool + """ super(Argument, self).__init__(**kwargs) self.name = name self.value = value @@ -286,16 +338,16 @@ class AuthInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType - :param token: Required. The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int + :ivar token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". + :vartype token_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType + :ivar token: Required. The access token used to access the source control provider. + :vartype token: str + :ivar refresh_token: The refresh token used to refresh the access token. + :vartype refresh_token: str + :ivar scope: The scope of the access token. + :vartype scope: str + :ivar expires_in: Time in seconds that the token remains valid. + :vartype expires_in: int """ _validation = { @@ -321,6 +373,19 @@ def __init__( expires_in: Optional[int] = None, **kwargs ): + """ + :keyword token_type: Required. The type of Auth token. Possible values include: "PAT", "OAuth". + :paramtype token_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType + :keyword token: Required. The access token used to access the source control provider. + :paramtype token: str + :keyword refresh_token: The refresh token used to refresh the access token. + :paramtype refresh_token: str + :keyword scope: The scope of the access token. + :paramtype scope: str + :keyword expires_in: Time in seconds that the token remains valid. + :paramtype expires_in: int + """ super(AuthInfo, self).__init__(**kwargs) self.token_type = token_type self.token = token @@ -332,16 +397,16 @@ def __init__( class AuthInfoUpdateParameters(msrest.serialization.Model): """The authorization properties for accessing the source code repository. - :param token_type: The type of Auth token. Possible values include: "PAT", "OAuth". - :type token_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType - :param token: The access token used to access the source control provider. - :type token: str - :param refresh_token: The refresh token used to refresh the access token. - :type refresh_token: str - :param scope: The scope of the access token. - :type scope: str - :param expires_in: Time in seconds that the token remains valid. - :type expires_in: int + :ivar token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :vartype token_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType + :ivar token: The access token used to access the source control provider. + :vartype token: str + :ivar refresh_token: The refresh token used to refresh the access token. + :vartype refresh_token: str + :ivar scope: The scope of the access token. + :vartype scope: str + :ivar expires_in: Time in seconds that the token remains valid. + :vartype expires_in: int """ _attribute_map = { @@ -362,6 +427,19 @@ def __init__( expires_in: Optional[int] = None, **kwargs ): + """ + :keyword token_type: The type of Auth token. Possible values include: "PAT", "OAuth". + :paramtype token_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TokenType + :keyword token: The access token used to access the source control provider. + :paramtype token: str + :keyword refresh_token: The refresh token used to refresh the access token. + :paramtype refresh_token: str + :keyword scope: The scope of the access token. + :paramtype scope: str + :keyword expires_in: Time in seconds that the token remains valid. + :paramtype expires_in: int + """ super(AuthInfoUpdateParameters, self).__init__(**kwargs) self.token_type = token_type self.token = token @@ -373,18 +451,18 @@ def __init__( class BaseImageDependency(msrest.serialization.Model): """Properties that describe a base image dependency. - :param type: The type of the base image dependency. Possible values include: "BuildTime", + :ivar type: The type of the base image dependency. Possible values include: "BuildTime", "RunTime". - :type type: str or + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependencyType - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -405,6 +483,20 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the base image dependency. Possible values include: "BuildTime", + "RunTime". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependencyType + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(BaseImageDependency, self).__init__(**kwargs) self.type = type self.registry = registry @@ -418,20 +510,20 @@ class BaseImageTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param base_image_trigger_type: Required. The type of the auto trigger for base image - dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or + :ivar base_image_trigger_type: Required. The type of the auto trigger for base image dependency + updates. Possible values include: "All", "Runtime". + :vartype base_image_trigger_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerType - :param update_trigger_endpoint: The endpoint URL for receiving update triggers. - :type update_trigger_endpoint: str - :param update_trigger_payload_type: Type of Payload body for Base image update triggers. + :ivar update_trigger_endpoint: The endpoint URL for receiving update triggers. + :vartype update_trigger_endpoint: str + :ivar update_trigger_payload_type: Type of Payload body for Base image update triggers. Possible values include: "Default", "Token". - :type update_trigger_payload_type: str or + :vartype update_trigger_payload_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UpdateTriggerPayloadType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -457,6 +549,23 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword base_image_trigger_type: Required. The type of the auto trigger for base image + dependency updates. Possible values include: "All", "Runtime". + :paramtype base_image_trigger_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerType + :keyword update_trigger_endpoint: The endpoint URL for receiving update triggers. + :paramtype update_trigger_endpoint: str + :keyword update_trigger_payload_type: Type of Payload body for Base image update triggers. + Possible values include: "Default", "Token". + :paramtype update_trigger_payload_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UpdateTriggerPayloadType + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(BaseImageTrigger, self).__init__(**kwargs) self.base_image_trigger_type = base_image_trigger_type self.update_trigger_endpoint = update_trigger_endpoint @@ -470,20 +579,20 @@ class BaseImageTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param base_image_trigger_type: The type of the auto trigger for base image dependency updates. + :ivar base_image_trigger_type: The type of the auto trigger for base image dependency updates. Possible values include: "All", "Runtime". - :type base_image_trigger_type: str or + :vartype base_image_trigger_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerType - :param update_trigger_endpoint: The endpoint URL for receiving update triggers. - :type update_trigger_endpoint: str - :param update_trigger_payload_type: Type of Payload body for Base image update triggers. + :ivar update_trigger_endpoint: The endpoint URL for receiving update triggers. + :vartype update_trigger_endpoint: str + :ivar update_trigger_payload_type: Type of Payload body for Base image update triggers. Possible values include: "Default", "Token". - :type update_trigger_payload_type: str or + :vartype update_trigger_payload_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UpdateTriggerPayloadType - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -508,6 +617,23 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword base_image_trigger_type: The type of the auto trigger for base image dependency + updates. Possible values include: "All", "Runtime". + :paramtype base_image_trigger_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerType + :keyword update_trigger_endpoint: The endpoint URL for receiving update triggers. + :paramtype update_trigger_endpoint: str + :keyword update_trigger_payload_type: Type of Payload body for Base image update triggers. + Possible values include: "Default", "Token". + :paramtype update_trigger_payload_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UpdateTriggerPayloadType + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(BaseImageTriggerUpdateParameters, self).__init__(**kwargs) self.base_image_trigger_type = base_image_trigger_type self.update_trigger_endpoint = update_trigger_endpoint @@ -519,14 +645,14 @@ def __init__( class Credentials(msrest.serialization.Model): """The parameters that describes a set of credentials that will be used when a run is invoked. - :param source_registry: Describes the credential parameters for accessing the source registry. - :type source_registry: + :ivar source_registry: Describes the credential parameters for accessing the source registry. + :vartype source_registry: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceRegistryCredentials - :param custom_registries: Describes the credential parameters for accessing other custom + :ivar custom_registries: Describes the credential parameters for accessing other custom registries. The key for the dictionary item will be the registry login server (myregistry.azurecr.io) and the value of the item will be the registry credentials for accessing the registry. - :type custom_registries: dict[str, + :vartype custom_registries: dict[str, ~azure.mgmt.containerregistry.v2019_06_01_preview.models.CustomRegistryCredentials] """ @@ -542,6 +668,18 @@ def __init__( custom_registries: Optional[Dict[str, "CustomRegistryCredentials"]] = None, **kwargs ): + """ + :keyword source_registry: Describes the credential parameters for accessing the source + registry. + :paramtype source_registry: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceRegistryCredentials + :keyword custom_registries: Describes the credential parameters for accessing other custom + registries. The key + for the dictionary item will be the registry login server (myregistry.azurecr.io) and + the value of the item will be the registry credentials for accessing the registry. + :paramtype custom_registries: dict[str, + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.CustomRegistryCredentials] + """ super(Credentials, self).__init__(**kwargs) self.source_registry = source_registry self.custom_registries = custom_registries @@ -550,19 +688,19 @@ def __init__( class CustomRegistryCredentials(msrest.serialization.Model): """Describes the credentials that will be used to access a custom registry during a run. - :param user_name: The username for logging into the custom registry. - :type user_name: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject - :param password: The password for logging into the custom registry. The password is a secret + :ivar user_name: The username for logging into the custom registry. + :vartype user_name: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject + :ivar password: The password for logging into the custom registry. The password is a secret object that allows multiple ways of providing the value for it. - :type password: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject - :param identity: Indicates the managed identity assigned to the custom credential. If a + :vartype password: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject + :ivar identity: Indicates the managed identity assigned to the custom credential. If a user-assigned identity this value is the Client ID. If a system-assigned identity, the value will be ``system``. In the case of a system-assigned identity, the Client ID will be determined by the runner. This identity may be used to authenticate to key vault to retrieve credentials or it may be the only source of authentication used for accessing the registry. - :type identity: str + :vartype identity: str """ _attribute_map = { @@ -579,6 +717,21 @@ def __init__( identity: Optional[str] = None, **kwargs ): + """ + :keyword user_name: The username for logging into the custom registry. + :paramtype user_name: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject + :keyword password: The password for logging into the custom registry. The password is a secret + object that allows multiple ways of providing the value for it. + :paramtype password: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObject + :keyword identity: Indicates the managed identity assigned to the custom credential. If a + user-assigned identity + this value is the Client ID. If a system-assigned identity, the value will be ``system``. In + the case of a system-assigned identity, the Client ID will be determined by the runner. This + identity may be used to authenticate to key vault to retrieve credentials or it may be the + only + source of authentication used for accessing the registry. + :paramtype identity: str + """ super(CustomRegistryCredentials, self).__init__(**kwargs) self.user_name = user_name self.password = password @@ -593,16 +746,16 @@ class RunRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log + :vartype is_archive_enabled: bool + :ivar agent_pool_name: The dedicated agent pool for the run. + :vartype agent_pool_name: str + :ivar log_template: The template that describes the repository and tag information for run log artifact. - :type log_template: str + :vartype log_template: str """ _validation = { @@ -628,6 +781,16 @@ def __init__( log_template: Optional[str] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword agent_pool_name: The dedicated agent pool for the run. + :paramtype agent_pool_name: str + :keyword log_template: The template that describes the repository and tag information for run + log artifact. + :paramtype log_template: str + """ super(RunRequest, self).__init__(**kwargs) self.type = None # type: Optional[str] self.is_archive_enabled = is_archive_enabled @@ -640,45 +803,44 @@ class DockerBuildRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log + :vartype is_archive_enabled: bool + :ivar agent_pool_name: The dedicated agent pool for the run. + :vartype agent_pool_name: str + :ivar log_template: The template that describes the repository and tag information for run log artifact. - :type log_template: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :vartype log_template: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source location. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing the run. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: Required. The Docker file path relative to the source location. + :vartype docker_file_path: str + :ivar target: The name of the target build stage for the docker build. + :vartype target: str + :ivar arguments: The collection of override arguments to be used when executing the run. + :vartype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials """ _validation = { @@ -725,6 +887,46 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword agent_pool_name: The dedicated agent pool for the run. + :paramtype agent_pool_name: str + :keyword log_template: The template that describes the repository and tag information for run + log artifact. + :paramtype log_template: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: Required. The Docker file path relative to the source location. + :paramtype docker_file_path: str + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + :keyword arguments: The collection of override arguments to be used when executing the run. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + """ super(DockerBuildRequest, self).__init__(is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs) self.type = 'DockerBuildRequest' # type: str self.image_names = image_names @@ -750,17 +952,17 @@ class TaskStepProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str """ _validation = { @@ -786,6 +988,13 @@ def __init__( context_access_token: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + """ super(TaskStepProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.base_image_dependencies = None @@ -800,32 +1009,31 @@ class DockerBuildStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: Required. The Docker file path relative to the source context. - :type docker_file_path: str - :param target: The name of the target build stage for the docker build. - :type target: str - :param arguments: The collection of override arguments to be used when executing this build + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: Required. The Docker file path relative to the source context. + :vartype docker_file_path: str + :ivar target: The name of the target build stage for the docker build. + :vartype target: str + :ivar arguments: The collection of override arguments to be used when executing this build step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + :vartype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] """ _validation = { @@ -860,6 +1068,28 @@ def __init__( arguments: Optional[List["Argument"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: Required. The Docker file path relative to the source context. + :paramtype docker_file_path: str + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + :keyword arguments: The collection of override arguments to be used when executing this build + step. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + """ super(DockerBuildStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'Docker' # type: str self.image_names = image_names @@ -878,14 +1108,14 @@ class TaskStepUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str """ _validation = { @@ -909,6 +1139,13 @@ def __init__( context_access_token: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + """ super(TaskStepUpdateParameters, self).__init__(**kwargs) self.type = None # type: Optional[str] self.context_path = context_path @@ -920,29 +1157,28 @@ class DockerBuildStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param image_names: The fully qualified image names including the repository and tag. - :type image_names: list[str] - :param is_push_enabled: The value of this property indicates whether the image built should be + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar image_names: The fully qualified image names including the repository and tag. + :vartype image_names: list[str] + :ivar is_push_enabled: The value of this property indicates whether the image built should be pushed to the registry or not. - :type is_push_enabled: bool - :param no_cache: The value of this property indicates whether the image cache is enabled or - not. - :type no_cache: bool - :param docker_file_path: The Docker file path relative to the source context. - :type docker_file_path: str - :param arguments: The collection of override arguments to be used when executing this build + :vartype is_push_enabled: bool + :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. + :vartype no_cache: bool + :ivar docker_file_path: The Docker file path relative to the source context. + :vartype docker_file_path: str + :ivar arguments: The collection of override arguments to be used when executing this build step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str + :vartype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + :ivar target: The name of the target build stage for the docker build. + :vartype target: str """ _validation = { @@ -974,6 +1210,28 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword image_names: The fully qualified image names including the repository and tag. + :paramtype image_names: list[str] + :keyword is_push_enabled: The value of this property indicates whether the image built should + be pushed to the registry or not. + :paramtype is_push_enabled: bool + :keyword no_cache: The value of this property indicates whether the image cache is enabled or + not. + :paramtype no_cache: bool + :keyword docker_file_path: The Docker file path relative to the source context. + :paramtype docker_file_path: str + :keyword arguments: The collection of override arguments to be used when executing this build + step. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + """ super(DockerBuildStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'Docker' # type: str self.image_names = image_names @@ -989,38 +1247,38 @@ class EncodedTaskRunRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log + :vartype is_archive_enabled: bool + :ivar agent_pool_name: The dedicated agent pool for the run. + :vartype agent_pool_name: str + :ivar log_template: The template that describes the repository and tag information for run log artifact. - :type log_template: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file + :vartype log_template: str + :ivar encoded_task_content: Required. Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials """ _validation = { @@ -1061,6 +1319,39 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword agent_pool_name: The dedicated agent pool for the run. + :paramtype agent_pool_name: str + :keyword log_template: The template that describes the repository and tag information for run + log artifact. + :paramtype log_template: str + :keyword encoded_task_content: Required. Base64 encoded value of the template/definition file + content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + """ super(EncodedTaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs) self.type = 'EncodedTaskRunRequest' # type: str self.encoded_task_content = encoded_task_content @@ -1080,24 +1371,24 @@ class EncodedTaskStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Required. Base64 encoded value of the template/definition file + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar encoded_task_content: Required. Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] """ _validation = { @@ -1126,6 +1417,20 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword encoded_task_content: Required. Base64 encoded value of the template/definition file + content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + """ super(EncodedTaskStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'EncodedTask' # type: str self.encoded_task_content = encoded_task_content @@ -1138,20 +1443,20 @@ class EncodedTaskStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param encoded_task_content: Base64 encoded value of the template/definition file content. - :type encoded_task_content: str - :param encoded_values_content: Base64 encoded value of the parameters/values file content. - :type encoded_values_content: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar encoded_task_content: Base64 encoded value of the template/definition file content. + :vartype encoded_task_content: str + :ivar encoded_values_content: Base64 encoded value of the parameters/values file content. + :vartype encoded_values_content: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] """ _validation = { @@ -1177,6 +1482,19 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword encoded_task_content: Base64 encoded value of the template/definition file content. + :paramtype encoded_task_content: str + :keyword encoded_values_content: Base64 encoded value of the parameters/values file content. + :paramtype encoded_values_content: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + """ super(EncodedTaskStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'EncodedTask' # type: str self.encoded_task_content = encoded_task_content @@ -1187,8 +1505,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the Azure Container Registry service. - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ErrorResponseBody + :ivar error: Azure container registry build API error body. + :vartype error: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ErrorResponseBody """ _attribute_map = { @@ -1201,6 +1519,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure container registry build API error body. + :paramtype error: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1210,15 +1532,16 @@ class ErrorResponseBody(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str + :ivar details: an array of additional nested error response info objects, as described by this contract. - :type details: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.InnerErrorDescription + :vartype details: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.InnerErrorDescription] """ _validation = { @@ -1230,7 +1553,7 @@ class ErrorResponseBody(msrest.serialization.Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, + 'details': {'key': 'details', 'type': '[InnerErrorDescription]'}, } def __init__( @@ -1239,9 +1562,21 @@ def __init__( code: str, message: str, target: Optional[str] = None, - details: Optional["InnerErrorDescription"] = None, - **kwargs - ): + details: Optional[List["InnerErrorDescription"]] = None, + **kwargs + ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + :keyword details: an array of additional nested error response info objects, as described by + this contract. + :paramtype details: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.InnerErrorDescription] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1254,37 +1589,37 @@ class FileTaskRunRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log + :vartype is_archive_enabled: bool + :ivar agent_pool_name: The dedicated agent pool for the run. + :vartype agent_pool_name: str + :ivar log_template: The template that describes the repository and tag information for run log artifact. - :type log_template: str - :param task_file_path: Required. The template/definition file path relative to the source. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - :param timeout: Run timeout in seconds. - :type timeout: int - :param platform: Required. The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: + :vartype log_template: str + :ivar task_file_path: Required. The template/definition file path relative to the source. + :vartype task_file_path: str + :ivar values_file_path: The values/parameters file path relative to the source. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar platform: Required. The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_location: The URL(absolute or relative) of the source context. It can be an URL - to a tar or git repository. + :ivar source_location: The URL(absolute or relative) of the source context. It can be an URL to + a tar or git repository. If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - :type source_location: str - :param credentials: The properties that describes a set of credentials that will be used when + :vartype source_location: str + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + :vartype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials """ _validation = { @@ -1325,6 +1660,38 @@ def __init__( credentials: Optional["Credentials"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword agent_pool_name: The dedicated agent pool for the run. + :paramtype agent_pool_name: str + :keyword log_template: The template that describes the repository and tag information for run + log artifact. + :paramtype log_template: str + :keyword task_file_path: Required. The template/definition file path relative to the source. + :paramtype task_file_path: str + :keyword values_file_path: The values/parameters file path relative to the source. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword platform: Required. The platform properties against which the run has to happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties + :keyword source_location: The URL(absolute or relative) of the source context. It can be an URL + to a tar or git repository. + If it is relative URL, the relative path should be obtained from calling + listBuildSourceUploadUrl API. + :paramtype source_location: str + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + """ super(FileTaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs) self.type = 'FileTaskRunRequest' # type: str self.task_file_path = task_file_path @@ -1344,24 +1711,24 @@ class FileTaskStep(TaskStepProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType :ivar base_image_dependencies: List of base image dependencies for a step. :vartype base_image_dependencies: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageDependency] - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: Required. The task template/definition file path relative to the source + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar task_file_path: Required. The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The task values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :vartype task_file_path: str + :ivar values_file_path: The task values/parameters file path relative to the source context. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] """ _validation = { @@ -1390,6 +1757,20 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword task_file_path: Required. The task template/definition file path relative to the + source context. + :paramtype task_file_path: str + :keyword values_file_path: The task values/parameters file path relative to the source context. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + """ super(FileTaskStep, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'FileTask' # type: str self.task_file_path = task_file_path @@ -1402,20 +1783,20 @@ class FileTaskStepUpdateParameters(TaskStepUpdateParameters): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the step.Constant filled by server. Possible values - include: "Docker", "FileTask", "EncodedTask". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType - :param context_path: The URL(absolute or relative) of the source context for the task step. - :type context_path: str - :param context_access_token: The token (git PAT or SAS token of storage account blob) - associated with the context for a step. - :type context_access_token: str - :param task_file_path: The task template/definition file path relative to the source context. - :type task_file_path: str - :param values_file_path: The values/parameters file path relative to the source context. - :type values_file_path: str - :param values: The collection of overridable values that can be passed when running a task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :ivar type: Required. The type of the step.Constant filled by server. Possible values include: + "Docker", "FileTask", "EncodedTask". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.StepType + :ivar context_path: The URL(absolute or relative) of the source context for the task step. + :vartype context_path: str + :ivar context_access_token: The token (git PAT or SAS token of storage account blob) associated + with the context for a step. + :vartype context_access_token: str + :ivar task_file_path: The task template/definition file path relative to the source context. + :vartype task_file_path: str + :ivar values_file_path: The values/parameters file path relative to the source context. + :vartype values_file_path: str + :ivar values: The collection of overridable values that can be passed when running a task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] """ _validation = { @@ -1441,6 +1822,19 @@ def __init__( values: Optional[List["SetValue"]] = None, **kwargs ): + """ + :keyword context_path: The URL(absolute or relative) of the source context for the task step. + :paramtype context_path: str + :keyword context_access_token: The token (git PAT or SAS token of storage account blob) + associated with the context for a step. + :paramtype context_access_token: str + :keyword task_file_path: The task template/definition file path relative to the source context. + :paramtype task_file_path: str + :keyword values_file_path: The values/parameters file path relative to the source context. + :paramtype values_file_path: str + :keyword values: The collection of overridable values that can be passed when running a task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + """ super(FileTaskStepUpdateParameters, self).__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) self.type = 'FileTask' # type: str self.task_file_path = task_file_path @@ -1451,20 +1845,20 @@ def __init__( class IdentityProperties(msrest.serialization.Model): """Managed identity for the resource. - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UserIdentityProperties] """ @@ -1484,6 +1878,23 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.UserIdentityProperties] + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id @@ -1494,14 +1905,14 @@ def __init__( class ImageDescriptor(msrest.serialization.Model): """Properties for a registry image. - :param registry: The registry login server. - :type registry: str - :param repository: The repository name. - :type repository: str - :param tag: The tag name. - :type tag: str - :param digest: The sha256-based digest of the image manifest. - :type digest: str + :ivar registry: The registry login server. + :vartype registry: str + :ivar repository: The repository name. + :vartype repository: str + :ivar tag: The tag name. + :vartype tag: str + :ivar digest: The sha256-based digest of the image manifest. + :vartype digest: str """ _attribute_map = { @@ -1520,6 +1931,16 @@ def __init__( digest: Optional[str] = None, **kwargs ): + """ + :keyword registry: The registry login server. + :paramtype registry: str + :keyword repository: The repository name. + :paramtype repository: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword digest: The sha256-based digest of the image manifest. + :paramtype digest: str + """ super(ImageDescriptor, self).__init__(**kwargs) self.registry = registry self.repository = repository @@ -1530,12 +1951,12 @@ def __init__( class ImageUpdateTrigger(msrest.serialization.Model): """The image update trigger that caused a build. - :param id: The unique ID of the trigger. - :type id: str - :param timestamp: The timestamp when the image update happened. - :type timestamp: ~datetime.datetime - :param images: The list of image updates that caused the build. - :type images: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor] + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar timestamp: The timestamp when the image update happened. + :vartype timestamp: ~datetime.datetime + :ivar images: The list of image updates that caused the build. + :vartype images: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor] """ _attribute_map = { @@ -1552,6 +1973,15 @@ def __init__( images: Optional[List["ImageDescriptor"]] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword timestamp: The timestamp when the image update happened. + :paramtype timestamp: ~datetime.datetime + :keyword images: The list of image updates that caused the build. + :paramtype images: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor] + """ super(ImageUpdateTrigger, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -1563,12 +1993,12 @@ class InnerErrorDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str """ _validation = { @@ -1590,6 +2020,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + """ super(InnerErrorDescription, self).__init__(**kwargs) self.code = code self.message = message @@ -1599,20 +2037,20 @@ def __init__( class OverrideTaskStepProperties(msrest.serialization.Model): """OverrideTaskStepProperties. - :param context_path: The source context against which run has to be queued. - :type context_path: str - :param file: The file against which run has to be queued. - :type file: str - :param arguments: Gets or sets the collection of override arguments to be used when + :ivar context_path: The source context against which run has to be queued. + :vartype context_path: str + :ivar file: The file against which run has to be queued. + :vartype file: str + :ivar arguments: Gets or sets the collection of override arguments to be used when executing a build step. - :type arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] - :param target: The name of the target build stage for the docker build. - :type target: str - :param values: The collection of overridable values that can be passed when running a Task. - :type values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] - :param update_trigger_token: Base64 encoded update trigger token that will be attached with the + :vartype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + :ivar target: The name of the target build stage for the docker build. + :vartype target: str + :ivar values: The collection of overridable values that can be passed when running a Task. + :vartype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :ivar update_trigger_token: Base64 encoded update trigger token that will be attached with the base image trigger webhook. - :type update_trigger_token: str + :vartype update_trigger_token: str """ _attribute_map = { @@ -1635,6 +2073,22 @@ def __init__( update_trigger_token: Optional[str] = None, **kwargs ): + """ + :keyword context_path: The source context against which run has to be queued. + :paramtype context_path: str + :keyword file: The file against which run has to be queued. + :paramtype file: str + :keyword arguments: Gets or sets the collection of override arguments to be used when + executing a build step. + :paramtype arguments: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Argument] + :keyword target: The name of the target build stage for the docker build. + :paramtype target: str + :keyword values: The collection of overridable values that can be passed when running a Task. + :paramtype values: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SetValue] + :keyword update_trigger_token: Base64 encoded update trigger token that will be attached with + the base image trigger webhook. + :paramtype update_trigger_token: str + """ super(OverrideTaskStepProperties, self).__init__(**kwargs) self.context_path = context_path self.file = file @@ -1649,15 +2103,15 @@ class PlatformProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os: Required. The operating system type required for the run. Possible values include: + :ivar os: Required. The operating system type required for the run. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "386", - "arm", "arm64". - :type architecture: str or + :vartype os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS + :ivar architecture: The OS architecture. Possible values include: "amd64", "x86", "386", "arm", + "arm64". + :vartype architecture: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant + :ivar variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :vartype variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant """ _validation = { @@ -1678,6 +2132,17 @@ def __init__( variant: Optional[Union[str, "Variant"]] = None, **kwargs ): + """ + :keyword os: Required. The operating system type required for the run. Possible values include: + "Windows", "Linux". + :paramtype os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS + :keyword architecture: The OS architecture. Possible values include: "amd64", "x86", "386", + "arm", "arm64". + :paramtype architecture: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Architecture + :keyword variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :paramtype variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant + """ super(PlatformProperties, self).__init__(**kwargs) self.os = os self.architecture = architecture @@ -1687,15 +2152,15 @@ def __init__( class PlatformUpdateParameters(msrest.serialization.Model): """The properties for updating the platform configuration. - :param os: The operating system type required for the run. Possible values include: "Windows", + :ivar os: The operating system type required for the run. Possible values include: "Windows", "Linux". - :type os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS - :param architecture: The OS architecture. Possible values include: "amd64", "x86", "386", - "arm", "arm64". - :type architecture: str or + :vartype os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS + :ivar architecture: The OS architecture. Possible values include: "amd64", "x86", "386", "arm", + "arm64". + :vartype architecture: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Architecture - :param variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". - :type variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant + :ivar variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :vartype variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant """ _attribute_map = { @@ -1712,6 +2177,17 @@ def __init__( variant: Optional[Union[str, "Variant"]] = None, **kwargs ): + """ + :keyword os: The operating system type required for the run. Possible values include: + "Windows", "Linux". + :paramtype os: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OS + :keyword architecture: The OS architecture. Possible values include: "amd64", "x86", "386", + "arm", "arm64". + :paramtype architecture: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Architecture + :keyword variant: Variant of the CPU. Possible values include: "v6", "v7", "v8". + :paramtype variant: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Variant + """ super(PlatformUpdateParameters, self).__init__(**kwargs) self.os = os self.architecture = architecture @@ -1751,6 +2227,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1771,63 +2249,63 @@ class Run(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param run_id: The unique identifier for the run. - :type run_id: str - :param status: The current status of the run. Possible values include: "Queued", "Started", + :ivar run_id: The unique identifier for the run. + :vartype run_id: str + :ivar status: The current status of the run. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus - :param last_updated_time: The last updated time for the run. - :type last_updated_time: ~datetime.datetime - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus + :ivar last_updated_time: The last updated time for the run. + :vartype last_updated_time: ~datetime.datetime + :ivar run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param create_time: The time the run was scheduled. - :type create_time: ~datetime.datetime - :param start_time: The time the run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_images: The list of all images that were generated from the run. This is + :vartype run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType + :ivar agent_pool_name: The dedicated agent pool for the run. + :vartype agent_pool_name: str + :ivar create_time: The time the run was scheduled. + :vartype create_time: ~datetime.datetime + :ivar start_time: The time the run started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the run finished. + :vartype finish_time: ~datetime.datetime + :ivar output_images: The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - :type output_images: + :vartype output_images: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor] - :param task: The task against which run was scheduled. - :type task: str - :param image_update_trigger: The image update trigger that caused the run. This is applicable - if the task has base image trigger configured. - :type image_update_trigger: + :ivar task: The task against which run was scheduled. + :vartype task: str + :ivar image_update_trigger: The image update trigger that caused the run. This is applicable if + the task has base image trigger configured. + :vartype image_update_trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageUpdateTrigger - :param source_trigger: The source trigger that caused the run. - :type source_trigger: + :ivar source_trigger: The source trigger that caused the run. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerDescriptor - :param timer_trigger: The timer trigger that caused the run. - :type timer_trigger: + :ivar timer_trigger: The timer trigger that caused the run. + :vartype timer_trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTriggerDescriptor - :param platform: The platform properties against which the run will happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: + :ivar platform: The platform properties against which the run will happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param source_registry_auth: The scope of the credentials that were used to login to the source + :ivar source_registry_auth: The scope of the credentials that were used to login to the source registry during this run. - :type source_registry_auth: str - :param custom_registries: The list of custom registries that were logged in during this run. - :type custom_registries: list[str] + :vartype source_registry_auth: str + :ivar custom_registries: The list of custom registries that were logged in during this run. + :vartype custom_registries: list[str] :ivar run_error_message: The error message received from backend systems after the run is scheduled. :vartype run_error_message: str - :param update_trigger_token: The update trigger token passed for the Run. - :type update_trigger_token: str + :ivar update_trigger_token: The update trigger token passed for the Run. + :vartype update_trigger_token: str :ivar log_artifact: The image description for the log artifact. :vartype log_artifact: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor - :param provisioning_state: The provisioning state of a run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :type provisioning_state: str or + :ivar provisioning_state: The provisioning state of a run. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool """ _validation = { @@ -1893,6 +2371,61 @@ def __init__( is_archive_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword run_id: The unique identifier for the run. + :paramtype run_id: str + :keyword status: The current status of the run. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus + :keyword last_updated_time: The last updated time for the run. + :paramtype last_updated_time: ~datetime.datetime + :keyword run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + "AutoBuild", "AutoRun". + :paramtype run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType + :keyword agent_pool_name: The dedicated agent pool for the run. + :paramtype agent_pool_name: str + :keyword create_time: The time the run was scheduled. + :paramtype create_time: ~datetime.datetime + :keyword start_time: The time the run started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the run finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_images: The list of all images that were generated from the run. This is + applicable if the run generates base image dependencies. + :paramtype output_images: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageDescriptor] + :keyword task: The task against which run was scheduled. + :paramtype task: str + :keyword image_update_trigger: The image update trigger that caused the run. This is applicable + if the task has base image trigger configured. + :paramtype image_update_trigger: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ImageUpdateTrigger + :keyword source_trigger: The source trigger that caused the run. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerDescriptor + :keyword timer_trigger: The timer trigger that caused the run. + :paramtype timer_trigger: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTriggerDescriptor + :keyword platform: The platform properties against which the run will happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties + :keyword source_registry_auth: The scope of the credentials that were used to login to the + source registry during this run. + :paramtype source_registry_auth: str + :keyword custom_registries: The list of custom registries that were logged in during this run. + :paramtype custom_registries: list[str] + :keyword update_trigger_token: The update trigger token passed for the Run. + :paramtype update_trigger_token: str + :keyword provisioning_state: The provisioning state of a run. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + """ super(Run, self).__init__(**kwargs) self.run_id = run_id self.status = status @@ -1921,28 +2454,28 @@ def __init__( class RunFilter(msrest.serialization.Model): """Properties that are enabled for Odata querying on runs. - :param run_id: The unique identifier for the run. - :type run_id: str - :param run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + :ivar run_id: The unique identifier for the run. + :vartype run_id: str + :ivar run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", "AutoBuild", "AutoRun". - :type run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType - :param status: The current status of the run. Possible values include: "Queued", "Started", + :vartype run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType + :ivar status: The current status of the run. Possible values include: "Queued", "Started", "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus - :param create_time: The create time for a run. - :type create_time: ~datetime.datetime - :param finish_time: The time the run finished. - :type finish_time: ~datetime.datetime - :param output_image_manifests: The list of comma-separated image manifests that were generated + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus + :ivar create_time: The create time for a run. + :vartype create_time: ~datetime.datetime + :ivar finish_time: The time the run finished. + :vartype finish_time: ~datetime.datetime + :ivar output_image_manifests: The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of build type. - :type output_image_manifests: str - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool - :param task_name: The name of the task that the run corresponds to. - :type task_name: str - :param agent_pool_name: The name of the agent pool that the run corresponds to. - :type agent_pool_name: str + :vartype output_image_manifests: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool + :ivar task_name: The name of the task that the run corresponds to. + :vartype task_name: str + :ivar agent_pool_name: The name of the agent pool that the run corresponds to. + :vartype agent_pool_name: str """ _attribute_map = { @@ -1971,6 +2504,30 @@ def __init__( agent_pool_name: Optional[str] = None, **kwargs ): + """ + :keyword run_id: The unique identifier for the run. + :paramtype run_id: str + :keyword run_type: The type of run. Possible values include: "QuickBuild", "QuickRun", + "AutoBuild", "AutoRun". + :paramtype run_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunType + :keyword status: The current status of the run. Possible values include: "Queued", "Started", + "Running", "Succeeded", "Failed", "Canceled", "Error", "Timeout". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunStatus + :keyword create_time: The create time for a run. + :paramtype create_time: ~datetime.datetime + :keyword finish_time: The time the run finished. + :paramtype finish_time: ~datetime.datetime + :keyword output_image_manifests: The list of comma-separated image manifests that were + generated from the run. This is applicable if the run is of + build type. + :paramtype output_image_manifests: str + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + :keyword task_name: The name of the task that the run corresponds to. + :paramtype task_name: str + :keyword agent_pool_name: The name of the agent pool that the run corresponds to. + :paramtype agent_pool_name: str + """ super(RunFilter, self).__init__(**kwargs) self.run_id = run_id self.run_type = run_type @@ -1986,10 +2543,10 @@ def __init__( class RunGetLogResult(msrest.serialization.Model): """The result of get log link operation. - :param log_link: The link to logs for a run on a azure container registry. - :type log_link: str - :param log_artifact_link: The link to logs in registry for a run on a azure container registry. - :type log_artifact_link: str + :ivar log_link: The link to logs for a run on a azure container registry. + :vartype log_link: str + :ivar log_artifact_link: The link to logs in registry for a run on a azure container registry. + :vartype log_artifact_link: str """ _attribute_map = { @@ -2004,6 +2561,13 @@ def __init__( log_artifact_link: Optional[str] = None, **kwargs ): + """ + :keyword log_link: The link to logs for a run on a azure container registry. + :paramtype log_link: str + :keyword log_artifact_link: The link to logs in registry for a run on a azure container + registry. + :paramtype log_artifact_link: str + """ super(RunGetLogResult, self).__init__(**kwargs) self.log_link = log_link self.log_artifact_link = log_artifact_link @@ -2012,10 +2576,10 @@ def __init__( class RunListResult(msrest.serialization.Model): """Collection of runs. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -2030,6 +2594,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(RunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2038,8 +2608,8 @@ def __init__( class RunUpdateParameters(msrest.serialization.Model): """The set of run properties that can be updated. - :param is_archive_enabled: The value that indicates whether archiving is enabled or not. - :type is_archive_enabled: bool + :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. + :vartype is_archive_enabled: bool """ _attribute_map = { @@ -2052,6 +2622,10 @@ def __init__( is_archive_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. + :paramtype is_archive_enabled: bool + """ super(RunUpdateParameters, self).__init__(**kwargs) self.is_archive_enabled = is_archive_enabled @@ -2059,14 +2633,14 @@ def __init__( class SecretObject(msrest.serialization.Model): """Describes the properties of a secret object value. - :param value: The value of the secret. The format of this value will be determined + :ivar value: The value of the secret. The format of this value will be determined based on the type of the secret object. If the type is Opaque, the value will be used as is without any modification. - :type value: str - :param type: The type of the secret object which determines how the value of the secret object + :vartype value: str + :ivar type: The type of the secret object which determines how the value of the secret object has to be interpreted. Possible values include: "Opaque", "Vaultsecret". - :type type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObjectType + :vartype type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObjectType """ _attribute_map = { @@ -2081,6 +2655,17 @@ def __init__( type: Optional[Union[str, "SecretObjectType"]] = None, **kwargs ): + """ + :keyword value: The value of the secret. The format of this value will be determined + based on the type of the secret object. If the type is Opaque, the value will be + used as is without any modification. + :paramtype value: str + :keyword type: The type of the secret object which determines how the value of the secret + object has to be + interpreted. Possible values include: "Opaque", "Vaultsecret". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SecretObjectType + """ super(SecretObject, self).__init__(**kwargs) self.value = value self.type = type @@ -2091,12 +2676,12 @@ class SetValue(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the overridable value. - :type name: str - :param value: Required. The overridable value. - :type value: str - :param is_secret: Flag to indicate whether the value represents a secret or not. - :type is_secret: bool + :ivar name: Required. The name of the overridable value. + :vartype name: str + :ivar value: Required. The overridable value. + :vartype value: str + :ivar is_secret: Flag to indicate whether the value represents a secret or not. + :vartype is_secret: bool """ _validation = { @@ -2118,6 +2703,14 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword name: Required. The name of the overridable value. + :paramtype name: str + :keyword value: Required. The overridable value. + :paramtype value: str + :keyword is_secret: Flag to indicate whether the value represents a secret or not. + :paramtype is_secret: bool + """ super(SetValue, self).__init__(**kwargs) self.name = name self.value = value @@ -2129,18 +2722,18 @@ class SourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_control_type: Required. The type of source control service. Possible values + :ivar source_control_type: Required. The type of source control service. Possible values include: "Github", "VisualStudioTeamService". - :type source_control_type: str or + :vartype source_control_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceControlType - :param repository_url: Required. The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source + :ivar repository_url: Required. The full URL to the source code repository. + :vartype repository_url: str + :ivar branch: The branch name of the source code. + :vartype branch: str + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository and to set up webhooks for notifications. - :type source_control_auth_properties: + :vartype source_control_auth_properties: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AuthInfo """ @@ -2165,6 +2758,21 @@ def __init__( source_control_auth_properties: Optional["AuthInfo"] = None, **kwargs ): + """ + :keyword source_control_type: Required. The type of source control service. Possible values + include: "Github", "VisualStudioTeamService". + :paramtype source_control_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceControlType + :keyword repository_url: Required. The full URL to the source code repository. + :paramtype repository_url: str + :keyword branch: The branch name of the source code. + :paramtype branch: str + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository and to set up + webhooks for notifications. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AuthInfo + """ super(SourceProperties, self).__init__(**kwargs) self.source_control_type = source_control_type self.repository_url = repository_url @@ -2175,11 +2783,11 @@ def __init__( class SourceRegistryCredentials(msrest.serialization.Model): """Describes the credential parameters for accessing the source registry. - :param login_mode: The authentication mode which determines the source registry login scope. - The credentials for the source registry + :ivar login_mode: The authentication mode which determines the source registry login scope. The + credentials for the source registry will be generated using the given scope. These credentials will be used to login to the source registry during the run. Possible values include: "None", "Default". - :type login_mode: str or + :vartype login_mode: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceRegistryLoginMode """ @@ -2193,6 +2801,14 @@ def __init__( login_mode: Optional[Union[str, "SourceRegistryLoginMode"]] = None, **kwargs ): + """ + :keyword login_mode: The authentication mode which determines the source registry login scope. + The credentials for the source registry + will be generated using the given scope. These credentials will be used to login to + the source registry during the run. Possible values include: "None", "Default". + :paramtype login_mode: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceRegistryLoginMode + """ super(SourceRegistryCredentials, self).__init__(**kwargs) self.login_mode = login_mode @@ -2202,17 +2818,16 @@ class SourceTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_repository: Required. The properties that describes the source(code) for the - task. - :type source_repository: + :ivar source_repository: Required. The properties that describes the source(code) for the task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceProperties - :param source_trigger_events: Required. The source event corresponding to the trigger. - :type source_trigger_events: list[str or + :ivar source_trigger_events: Required. The source event corresponding to the trigger. + :vartype source_trigger_events: list[str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -2237,6 +2852,20 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword source_repository: Required. The properties that describes the source(code) for the + task. + :paramtype source_repository: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceProperties + :keyword source_trigger_events: Required. The source event corresponding to the trigger. + :paramtype source_trigger_events: list[str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerEvent] + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(SourceTrigger, self).__init__(**kwargs) self.source_repository = source_repository self.source_trigger_events = source_trigger_events @@ -2247,20 +2876,20 @@ def __init__( class SourceTriggerDescriptor(msrest.serialization.Model): """The source trigger that caused a run. - :param id: The unique ID of the trigger. - :type id: str - :param event_type: The event type of the trigger. - :type event_type: str - :param commit_id: The unique ID that identifies a commit. - :type commit_id: str - :param pull_request_id: The unique ID that identifies pull request. - :type pull_request_id: str - :param repository_url: The repository URL. - :type repository_url: str - :param branch_name: The branch name in the repository. - :type branch_name: str - :param provider_type: The source control provider type. - :type provider_type: str + :ivar id: The unique ID of the trigger. + :vartype id: str + :ivar event_type: The event type of the trigger. + :vartype event_type: str + :ivar commit_id: The unique ID that identifies a commit. + :vartype commit_id: str + :ivar pull_request_id: The unique ID that identifies pull request. + :vartype pull_request_id: str + :ivar repository_url: The repository URL. + :vartype repository_url: str + :ivar branch_name: The branch name in the repository. + :vartype branch_name: str + :ivar provider_type: The source control provider type. + :vartype provider_type: str """ _attribute_map = { @@ -2285,6 +2914,22 @@ def __init__( provider_type: Optional[str] = None, **kwargs ): + """ + :keyword id: The unique ID of the trigger. + :paramtype id: str + :keyword event_type: The event type of the trigger. + :paramtype event_type: str + :keyword commit_id: The unique ID that identifies a commit. + :paramtype commit_id: str + :keyword pull_request_id: The unique ID that identifies pull request. + :paramtype pull_request_id: str + :keyword repository_url: The repository URL. + :paramtype repository_url: str + :keyword branch_name: The branch name in the repository. + :paramtype branch_name: str + :keyword provider_type: The source control provider type. + :paramtype provider_type: str + """ super(SourceTriggerDescriptor, self).__init__(**kwargs) self.id = id self.event_type = event_type @@ -2300,16 +2945,16 @@ class SourceTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_repository: The properties that describes the source(code) for the task. - :type source_repository: + :ivar source_repository: The properties that describes the source(code) for the task. + :vartype source_repository: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceUpdateParameters - :param source_trigger_events: The source event corresponding to the trigger. - :type source_trigger_events: list[str or + :ivar source_trigger_events: The source event corresponding to the trigger. + :vartype source_trigger_events: list[str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerEvent] - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -2332,6 +2977,19 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword source_repository: The properties that describes the source(code) for the task. + :paramtype source_repository: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceUpdateParameters + :keyword source_trigger_events: The source event corresponding to the trigger. + :paramtype source_trigger_events: list[str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerEvent] + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(SourceTriggerUpdateParameters, self).__init__(**kwargs) self.source_repository = source_repository self.source_trigger_events = source_trigger_events @@ -2342,18 +3000,18 @@ def __init__( class SourceUpdateParameters(msrest.serialization.Model): """The properties for updating the source code repository. - :param source_control_type: The type of source control service. Possible values include: + :ivar source_control_type: The type of source control service. Possible values include: "Github", "VisualStudioTeamService". - :type source_control_type: str or + :vartype source_control_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceControlType - :param repository_url: The full URL to the source code repository. - :type repository_url: str - :param branch: The branch name of the source code. - :type branch: str - :param source_control_auth_properties: The authorization properties for accessing the source + :ivar repository_url: The full URL to the source code repository. + :vartype repository_url: str + :ivar branch: The branch name of the source code. + :vartype branch: str + :ivar source_control_auth_properties: The authorization properties for accessing the source code repository and to set up webhooks for notifications. - :type source_control_auth_properties: + :vartype source_control_auth_properties: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AuthInfoUpdateParameters """ @@ -2373,6 +3031,21 @@ def __init__( source_control_auth_properties: Optional["AuthInfoUpdateParameters"] = None, **kwargs ): + """ + :keyword source_control_type: The type of source control service. Possible values include: + "Github", "VisualStudioTeamService". + :paramtype source_control_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceControlType + :keyword repository_url: The full URL to the source code repository. + :paramtype repository_url: str + :keyword branch: The branch name of the source code. + :paramtype branch: str + :keyword source_control_auth_properties: The authorization properties for accessing the source + code repository and to set up + webhooks for notifications. + :paramtype source_control_auth_properties: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AuthInfoUpdateParameters + """ super(SourceUpdateParameters, self).__init__(**kwargs) self.source_control_type = source_control_type self.repository_url = repository_url @@ -2383,11 +3056,11 @@ def __init__( class SourceUploadDefinition(msrest.serialization.Model): """The properties of a response to source upload request. - :param upload_url: The URL where the client can upload the source. - :type upload_url: str - :param relative_path: The relative path to the source. This is used to submit the subsequent + :ivar upload_url: The URL where the client can upload the source. + :vartype upload_url: str + :ivar relative_path: The relative path to the source. This is used to submit the subsequent queue build request. - :type relative_path: str + :vartype relative_path: str """ _attribute_map = { @@ -2402,6 +3075,13 @@ def __init__( relative_path: Optional[str] = None, **kwargs ): + """ + :keyword upload_url: The URL where the client can upload the source. + :paramtype upload_url: str + :keyword relative_path: The relative path to the source. This is used to submit the subsequent + queue build request. + :paramtype relative_path: str + """ super(SourceUploadDefinition, self).__init__(**kwargs) self.upload_url = upload_url self.relative_path = relative_path @@ -2410,22 +3090,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :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: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2448,6 +3128,24 @@ def __init__( 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". + :paramtype created_by_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_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". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -2471,45 +3169,45 @@ class Task(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties :ivar provisioning_state: The provisioning state of the task. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState :ivar creation_date: The creation date of task. :vartype creation_date: ~datetime.datetime - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: + :ivar status: The current status of task. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus + :ivar platform: The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param agent_pool_name: The dedicated agent pool for the task. - :type agent_pool_name: str - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties of a task step. - :type step: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepProperties - :param trigger: The properties that describe all triggers for the task. - :type trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerProperties - :param credentials: The properties that describes a set of credentials that will be used when + :ivar agent_pool_name: The dedicated agent pool for the task. + :vartype agent_pool_name: str + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar step: The properties of a task step. + :vartype step: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepProperties + :ivar trigger: The properties that describe all triggers for the task. + :vartype trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerProperties + :ivar credentials: The properties that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials - :param log_template: The template that describes the repository and tag information for run log + :vartype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + :ivar log_template: The template that describes the repository and tag information for run log artifact. - :type log_template: str - :param is_system_task: The value of this property indicates whether the task resource is system + :vartype log_template: str + :ivar is_system_task: The value of this property indicates whether the task resource is system task or not. - :type is_system_task: bool + :vartype is_system_task: bool """ _validation = { @@ -2563,6 +3261,41 @@ def __init__( is_system_task: Optional[bool] = False, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity for the resource. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :keyword status: The current status of task. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus + :keyword platform: The platform properties against which the run has to happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformProperties + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties + :keyword agent_pool_name: The dedicated agent pool for the task. + :paramtype agent_pool_name: str + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword step: The properties of a task step. + :paramtype step: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepProperties + :keyword trigger: The properties that describe all triggers for the task. + :paramtype trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerProperties + :keyword credentials: The properties that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + :keyword log_template: The template that describes the repository and tag information for run + log artifact. + :paramtype log_template: str + :keyword is_system_task: The value of this property indicates whether the task resource is + system task or not. + :paramtype is_system_task: bool + """ super(Task, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None @@ -2582,10 +3315,10 @@ def __init__( class TaskListResult(msrest.serialization.Model): """The collection of tasks. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -2600,6 +3333,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(TaskListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2619,21 +3358,21 @@ class TaskRun(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SystemData - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties - :param location: The location of the resource. - :type location: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :ivar location: The location of the resource. + :vartype location: str :ivar provisioning_state: The provisioning state of this task run. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState - :param run_request: The request (parameters) for the run. - :type run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :ivar run_request: The request (parameters) for the run. + :vartype run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest :ivar run_result: The result of this task run. :vartype run_result: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run - :param force_update_tag: How the run should be forced to rerun even if the run request + :ivar force_update_tag: How the run should be forced to rerun even if the run request configuration has not changed. - :type force_update_tag: str + :vartype force_update_tag: str """ _validation = { @@ -2667,6 +3406,18 @@ def __init__( force_update_tag: Optional[str] = None, **kwargs ): + """ + :keyword identity: Identity for the resource. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :keyword location: The location of the resource. + :paramtype location: str + :keyword run_request: The request (parameters) for the run. + :paramtype run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :keyword force_update_tag: How the run should be forced to rerun even if the run request + configuration has not changed. + :paramtype force_update_tag: str + """ super(TaskRun, self).__init__(**kwargs) self.identity = identity self.location = location @@ -2679,10 +3430,10 @@ def __init__( class TaskRunListResult(msrest.serialization.Model): """The collection of task runs. - :param value: The collection value. - :type value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] - :param next_link: The URI that can be used to request the next set of paged results. - :type next_link: str + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + :ivar next_link: The URI that can be used to request the next set of paged results. + :vartype next_link: str """ _attribute_map = { @@ -2697,6 +3448,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + :keyword next_link: The URI that can be used to request the next set of paged results. + :paramtype next_link: str + """ super(TaskRunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2707,21 +3464,21 @@ class TaskRunRequest(RunRequest): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the run request.Constant filled by server. - :type type: str - :param is_archive_enabled: The value that indicates whether archiving is enabled for the run or + :ivar type: Required. The type of the run request.Constant filled by server. + :vartype type: str + :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or not. - :type is_archive_enabled: bool - :param agent_pool_name: The dedicated agent pool for the run. - :type agent_pool_name: str - :param log_template: The template that describes the repository and tag information for run log + :vartype is_archive_enabled: bool + :ivar agent_pool_name: The dedicated agent pool for the run. + :vartype agent_pool_name: str + :ivar log_template: The template that describes the repository and tag information for run log artifact. - :type log_template: str - :param task_id: Required. The resource ID of task against which run has to be queued. - :type task_id: str - :param override_task_step_properties: Set of overridable parameters that can be passed when + :vartype log_template: str + :ivar task_id: Required. The resource ID of task against which run has to be queued. + :vartype task_id: str + :ivar override_task_step_properties: Set of overridable parameters that can be passed when running a Task. - :type override_task_step_properties: + :vartype override_task_step_properties: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OverrideTaskStepProperties """ @@ -2749,6 +3506,22 @@ def __init__( override_task_step_properties: Optional["OverrideTaskStepProperties"] = None, **kwargs ): + """ + :keyword is_archive_enabled: The value that indicates whether archiving is enabled for the run + or not. + :paramtype is_archive_enabled: bool + :keyword agent_pool_name: The dedicated agent pool for the run. + :paramtype agent_pool_name: str + :keyword log_template: The template that describes the repository and tag information for run + log artifact. + :paramtype log_template: str + :keyword task_id: Required. The resource ID of task against which run has to be queued. + :paramtype task_id: str + :keyword override_task_step_properties: Set of overridable parameters that can be passed when + running a Task. + :paramtype override_task_step_properties: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.OverrideTaskStepProperties + """ super(TaskRunRequest, self).__init__(is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs) self.type = 'TaskRunRequest' # type: str self.task_id = task_id @@ -2758,17 +3531,17 @@ def __init__( class TaskRunUpdateParameters(msrest.serialization.Model): """The parameters for updating a task run. - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param run_request: The request (parameters) for the new run. - :type run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest - :param force_update_tag: How the run should be forced to rerun even if the run request + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :ivar location: The location of the resource. + :vartype location: str + :ivar tags: A set of tags. The ARM resource tags. + :vartype tags: dict[str, str] + :ivar run_request: The request (parameters) for the new run. + :vartype run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :ivar force_update_tag: How the run should be forced to rerun even if the run request configuration has not changed. - :type force_update_tag: str + :vartype force_update_tag: str """ _attribute_map = { @@ -2789,6 +3562,20 @@ def __init__( force_update_tag: Optional[str] = None, **kwargs ): + """ + :keyword identity: Identity for the resource. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :keyword location: The location of the resource. + :paramtype location: str + :keyword tags: A set of tags. The ARM resource tags. + :paramtype tags: dict[str, str] + :keyword run_request: The request (parameters) for the new run. + :paramtype run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :keyword force_update_tag: How the run should be forced to rerun even if the run request + configuration has not changed. + :paramtype force_update_tag: str + """ super(TaskRunUpdateParameters, self).__init__(**kwargs) self.identity = identity self.location = location @@ -2800,32 +3587,34 @@ def __init__( class TaskUpdateParameters(msrest.serialization.Model): """The parameters for updating a task. - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties - :param tags: A set of tags. The ARM resource tags. - :type tags: dict[str, str] - :param status: The current status of task. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus - :param platform: The platform properties against which the run has to happen. - :type platform: + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :ivar tags: A set of tags. The ARM resource tags. + :vartype tags: dict[str, str] + :ivar status: The current status of task. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus + :ivar platform: The platform properties against which the run has to happen. + :vartype platform: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformUpdateParameters - :param agent_configuration: The machine configuration of the run agent. - :type agent_configuration: + :ivar agent_configuration: The machine configuration of the run agent. + :vartype agent_configuration: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties - :param agent_pool_name: The dedicated agent pool for the task. - :type agent_pool_name: str - :param timeout: Run timeout in seconds. - :type timeout: int - :param step: The properties for updating a task step. - :type step: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepUpdateParameters - :param trigger: The properties for updating trigger properties. - :type trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerUpdateParameters - :param credentials: The parameters that describes a set of credentials that will be used when + :ivar agent_pool_name: The dedicated agent pool for the task. + :vartype agent_pool_name: str + :ivar timeout: Run timeout in seconds. + :vartype timeout: int + :ivar step: The properties for updating a task step. + :vartype step: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepUpdateParameters + :ivar trigger: The properties for updating trigger properties. + :vartype trigger: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerUpdateParameters + :ivar credentials: The parameters that describes a set of credentials that will be used when this run is invoked. - :type credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials - :param log_template: The template that describes the repository and tag information for run log + :vartype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + :ivar log_template: The template that describes the repository and tag information for run log artifact. - :type log_template: str + :vartype log_template: str """ _attribute_map = { @@ -2858,6 +3647,37 @@ def __init__( log_template: Optional[str] = None, **kwargs ): + """ + :keyword identity: Identity for the resource. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :keyword tags: A set of tags. The ARM resource tags. + :paramtype tags: dict[str, str] + :keyword status: The current status of task. Possible values include: "Disabled", "Enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStatus + :keyword platform: The platform properties against which the run has to happen. + :paramtype platform: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.PlatformUpdateParameters + :keyword agent_configuration: The machine configuration of the run agent. + :paramtype agent_configuration: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentProperties + :keyword agent_pool_name: The dedicated agent pool for the task. + :paramtype agent_pool_name: str + :keyword timeout: Run timeout in seconds. + :paramtype timeout: int + :keyword step: The properties for updating a task step. + :paramtype step: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskStepUpdateParameters + :keyword trigger: The properties for updating trigger properties. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerUpdateParameters + :keyword credentials: The parameters that describes a set of credentials that will be used when + this run is invoked. + :paramtype credentials: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Credentials + :keyword log_template: The template that describes the repository and tag information for run + log artifact. + :paramtype log_template: str + """ super(TaskUpdateParameters, self).__init__(**kwargs) self.identity = identity self.tags = tags @@ -2877,12 +3697,12 @@ class TimerTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param schedule: Required. The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar schedule: Required. The CRON expression for the task schedule. + :vartype schedule: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -2904,6 +3724,15 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword schedule: Required. The CRON expression for the task schedule. + :paramtype schedule: str + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(TimerTrigger, self).__init__(**kwargs) self.schedule = schedule self.status = status @@ -2913,10 +3742,10 @@ def __init__( class TimerTriggerDescriptor(msrest.serialization.Model): """TimerTriggerDescriptor. - :param timer_trigger_name: The timer trigger name that caused the run. - :type timer_trigger_name: str - :param schedule_occurrence: The occurrence that triggered the run. - :type schedule_occurrence: str + :ivar timer_trigger_name: The timer trigger name that caused the run. + :vartype timer_trigger_name: str + :ivar schedule_occurrence: The occurrence that triggered the run. + :vartype schedule_occurrence: str """ _attribute_map = { @@ -2931,6 +3760,12 @@ def __init__( schedule_occurrence: Optional[str] = None, **kwargs ): + """ + :keyword timer_trigger_name: The timer trigger name that caused the run. + :paramtype timer_trigger_name: str + :keyword schedule_occurrence: The occurrence that triggered the run. + :paramtype schedule_occurrence: str + """ super(TimerTriggerDescriptor, self).__init__(**kwargs) self.timer_trigger_name = timer_trigger_name self.schedule_occurrence = schedule_occurrence @@ -2941,12 +3776,12 @@ class TimerTriggerUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param schedule: The CRON expression for the task schedule. - :type schedule: str - :param status: The current status of trigger. Possible values include: "Disabled", "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus - :param name: Required. The name of the trigger. - :type name: str + :ivar schedule: The CRON expression for the task schedule. + :vartype schedule: str + :ivar status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :ivar name: Required. The name of the trigger. + :vartype name: str """ _validation = { @@ -2967,6 +3802,15 @@ def __init__( status: Optional[Union[str, "TriggerStatus"]] = None, **kwargs ): + """ + :keyword schedule: The CRON expression for the task schedule. + :paramtype schedule: str + :keyword status: The current status of trigger. Possible values include: "Disabled", "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TriggerStatus + :keyword name: Required. The name of the trigger. + :paramtype name: str + """ super(TimerTriggerUpdateParameters, self).__init__(**kwargs) self.schedule = schedule self.status = status @@ -2976,14 +3820,14 @@ def __init__( class TriggerProperties(msrest.serialization.Model): """The properties of a trigger. - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: + :ivar timer_triggers: The collection of timer triggers. + :vartype timer_triggers: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTrigger] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: + :ivar source_triggers: The collection of triggers based on source code repository. + :vartype source_triggers: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTrigger] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: + :ivar base_image_trigger: The trigger based on base image dependencies. + :vartype base_image_trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTrigger """ @@ -3001,6 +3845,17 @@ def __init__( base_image_trigger: Optional["BaseImageTrigger"] = None, **kwargs ): + """ + :keyword timer_triggers: The collection of timer triggers. + :paramtype timer_triggers: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTrigger] + :keyword source_triggers: The collection of triggers based on source code repository. + :paramtype source_triggers: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTrigger] + :keyword base_image_trigger: The trigger based on base image dependencies. + :paramtype base_image_trigger: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTrigger + """ super(TriggerProperties, self).__init__(**kwargs) self.timer_triggers = timer_triggers self.source_triggers = source_triggers @@ -3010,14 +3865,14 @@ def __init__( class TriggerUpdateParameters(msrest.serialization.Model): """The properties for updating triggers. - :param timer_triggers: The collection of timer triggers. - :type timer_triggers: + :ivar timer_triggers: The collection of timer triggers. + :vartype timer_triggers: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTriggerUpdateParameters] - :param source_triggers: The collection of triggers based on source code repository. - :type source_triggers: + :ivar source_triggers: The collection of triggers based on source code repository. + :vartype source_triggers: list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerUpdateParameters] - :param base_image_trigger: The trigger based on base image dependencies. - :type base_image_trigger: + :ivar base_image_trigger: The trigger based on base image dependencies. + :vartype base_image_trigger: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerUpdateParameters """ @@ -3035,6 +3890,17 @@ def __init__( base_image_trigger: Optional["BaseImageTriggerUpdateParameters"] = None, **kwargs ): + """ + :keyword timer_triggers: The collection of timer triggers. + :paramtype timer_triggers: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TimerTriggerUpdateParameters] + :keyword source_triggers: The collection of triggers based on source code repository. + :paramtype source_triggers: + list[~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceTriggerUpdateParameters] + :keyword base_image_trigger: The trigger based on base image dependencies. + :paramtype base_image_trigger: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.BaseImageTriggerUpdateParameters + """ super(TriggerUpdateParameters, self).__init__(**kwargs) self.timer_triggers = timer_triggers self.source_triggers = source_triggers @@ -3044,10 +3910,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -3062,6 +3928,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_agent_pools_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_agent_pools_operations.py index bbca15ee4d86..efb0791c834f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_agent_pools_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_agent_pools_operations.py @@ -5,25 +5,266 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_queue_status_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AgentPoolsOperations(object): """AgentPoolsOperations operations. @@ -47,14 +288,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AgentPool" + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.AgentPool": """Gets the detailed information for a given agent pool. :param resource_group_name: The name of the resource group to which the container registry @@ -74,34 +315,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgentPool', pipeline_response) @@ -110,56 +341,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - agent_pool, # type: "_models.AgentPool" - **kwargs # type: Any - ): - # type: (...) -> "_models.AgentPool" + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + agent_pool: "_models.AgentPool", + **kwargs: Any + ) -> "_models.AgentPool": cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool, 'AgentPool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(agent_pool, 'AgentPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('AgentPool', pipeline_response) @@ -171,17 +392,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - agent_pool, # type: "_models.AgentPool" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AgentPool"] + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + agent_pool: "_models.AgentPool", + **kwargs: Any + ) -> LROPoller["_models.AgentPool"]: """Creates an agent pool for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -195,15 +418,19 @@ def begin_create( :type agent_pool: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,28 +443,21 @@ def begin_create( registry_name=registry_name, agent_pool_name=agent_pool_name, agent_pool=agent_pool, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -249,64 +469,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + 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', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified agent pool resource. :param resource_group_name: The name of the resource group to which the container registry @@ -318,15 +528,17 @@ def begin_delete( :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +553,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,56 +572,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - update_parameters, # type: "_models.AgentPoolUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.AgentPool" + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + update_parameters: "_models.AgentPoolUpdateParameters", + **kwargs: Any + ) -> "_models.AgentPool": cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(update_parameters, 'AgentPoolUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_parameters, 'AgentPoolUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('AgentPool', pipeline_response) @@ -429,17 +622,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - update_parameters, # type: "_models.AgentPoolUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AgentPool"] + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + update_parameters: "_models.AgentPoolUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.AgentPool"]: """Updates an agent pool with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -450,18 +645,23 @@ def begin_update( :param agent_pool_name: The name of the agent pool. :type agent_pool_name: str :param update_parameters: The parameters for updating an agent pool. - :type update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolUpdateParameters + :type update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,28 +674,21 @@ def begin_update( registry_name=registry_name, agent_pool_name=agent_pool_name, update_parameters=update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', 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 - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -507,15 +700,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AgentPoolListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.AgentPoolListResult"]: """Lists all the agent pools for a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -525,7 +719,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] @@ -533,36 +728,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AgentPoolListResult', pipeline_response) + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -575,25 +767,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools'} # type: ignore + @distributed_trace def get_queue_status( self, - resource_group_name, # type: str - registry_name, # type: str - agent_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AgentPoolQueueStatus" + resource_group_name: str, + registry_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.AgentPoolQueueStatus": """Gets the count of queued runs for a given agent pool. :param resource_group_name: The name of the resource group to which the container registry @@ -613,34 +806,24 @@ def get_queue_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_queue_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str', max_length=20, min_length=3, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_queue_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + agent_pool_name=agent_pool_name, + template_url=self.get_queue_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgentPoolQueueStatus', pipeline_response) @@ -649,4 +832,6 @@ def get_queue_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_queue_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py index 69d7702d0f7f..3aaf07819b8d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py @@ -5,24 +5,106 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_schedule_run_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_build_source_upload_url_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -48,50 +130,38 @@ def __init__(self, client, config, serializer, deserializer): def _schedule_run_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_request, # type: "_models.RunRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Run"] + resource_group_name: str, + registry_name: str, + run_request: "_models.RunRequest", + **kwargs: Any + ) -> Optional["_models.Run"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Run"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._schedule_run_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_request, 'RunRequest') + + request = build_schedule_run_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._schedule_run_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_request, 'RunRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -101,16 +171,18 @@ def _schedule_run_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _schedule_run_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + + @distributed_trace def begin_schedule_run( self, - resource_group_name, # type: str - registry_name, # type: str - run_request, # type: "_models.RunRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Run"] + resource_group_name: str, + registry_name: str, + run_request: "_models.RunRequest", + **kwargs: Any + ) -> LROPoller["_models.Run"]: """Schedules a new run based on the request parameters and add it to the run queue. :param resource_group_name: The name of the resource group to which the container registry @@ -122,15 +194,19 @@ def begin_schedule_run( :type run_request: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -142,27 +218,21 @@ def begin_schedule_run( resource_group_name=resource_group_name, registry_name=registry_name, run_request=run_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -174,15 +244,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_schedule_run.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'} # type: ignore + @distributed_trace def get_build_source_upload_url( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceUploadDefinition" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.SourceUploadDefinition": """Get the upload location for the user to be able to upload the source. :param resource_group_name: The name of the resource group to which the container registry @@ -200,33 +271,23 @@ def get_build_source_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_source_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_source_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get_build_source_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceUploadDefinition', pipeline_response) @@ -235,4 +296,6 @@ def get_build_source_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_source_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py index bbfc6e71e9e7..918a037f50d9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py @@ -5,25 +5,227 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_log_sas_url_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_cancel_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RunsOperations(object): """RunsOperations operations. @@ -47,15 +249,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RunListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.RunListResult"]: """Gets all the runs for a registry. :param resource_group_name: The name of the resource group to which the container registry @@ -72,7 +274,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RunListResult"] @@ -80,40 +283,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RunListResult', pipeline_response) + deserialized = self._deserialize("RunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,25 +326,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Run" + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> "_models.Run": """Gets the detailed information for a given run. :param resource_group_name: The name of the resource group to which the container registry @@ -164,34 +365,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Run', pipeline_response) @@ -200,56 +391,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - run_update_parameters, # type: "_models.RunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Run" + resource_group_name: str, + registry_name: str, + run_id: str, + run_update_parameters: "_models.RunUpdateParameters", + **kwargs: Any + ) -> "_models.Run": cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(run_update_parameters, 'RunUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_update_parameters, 'RunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Run', pipeline_response) @@ -261,17 +442,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - run_update_parameters, # type: "_models.RunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Run"] + resource_group_name: str, + registry_name: str, + run_id: str, + run_update_parameters: "_models.RunUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Run"]: """Patch the run properties. :param resource_group_name: The name of the resource group to which the container registry @@ -282,18 +465,23 @@ def begin_update( :param run_id: The run ID. :type run_id: str :param run_update_parameters: The run update properties. - :type run_update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunUpdateParameters + :type run_update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Run or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] lro_delay = kwargs.pop( 'polling_interval', @@ -306,28 +494,21 @@ def begin_update( registry_name=registry_name, run_id=run_id, run_update_parameters=run_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Run', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,16 +520,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'} # type: ignore + @distributed_trace def get_log_sas_url( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RunGetLogResult" + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> "_models.RunGetLogResult": """Gets a link to download the run logs. :param resource_group_name: The name of the resource group to which the container registry @@ -368,34 +550,24 @@ def get_log_sas_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_sas_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_sas_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self.get_log_sas_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RunGetLogResult', pipeline_response) @@ -404,64 +576,55 @@ def get_log_sas_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_sas_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl'} # type: ignore + def _cancel_initial( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + run_id=run_id, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - registry_name, # type: str - run_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + run_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancel an existing run. :param resource_group_name: The name of the resource group to which the container registry @@ -473,15 +636,17 @@ def begin_cancel( :type run_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -496,22 +661,14 @@ def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'runId': self._serialize.url("run_id", run_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -523,4 +680,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py index d63d8ceb1f72..03878db8d948 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py @@ -5,25 +5,266 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskRunName": _SERIALIZER.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_run_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskRunName": _SERIALIZER.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskRunName": _SERIALIZER.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_run_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskRunName": _SERIALIZER.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_details_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskRunName": _SERIALIZER.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TaskRunsOperations(object): """TaskRunsOperations operations. @@ -47,14 +288,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TaskRun" + resource_group_name: str, + registry_name: str, + task_run_name: str, + **kwargs: Any + ) -> "_models.TaskRun": """Gets the detailed information for a given task run. :param resource_group_name: The name of the resource group to which the container registry @@ -74,34 +315,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TaskRun', pipeline_response) @@ -110,56 +341,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - task_run, # type: "_models.TaskRun" - **kwargs # type: Any - ): - # type: (...) -> "_models.TaskRun" + resource_group_name: str, + registry_name: str, + task_run_name: str, + task_run: "_models.TaskRun", + **kwargs: Any + ) -> "_models.TaskRun": cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRun"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_run, 'TaskRun') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_run, 'TaskRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('TaskRun', pipeline_response) @@ -171,17 +392,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - task_run, # type: "_models.TaskRun" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.TaskRun"] + resource_group_name: str, + registry_name: str, + task_run_name: str, + task_run: "_models.TaskRun", + **kwargs: Any + ) -> LROPoller["_models.TaskRun"]: """Creates a task run for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -195,15 +418,19 @@ def begin_create( :type task_run: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,28 +443,21 @@ def begin_create( registry_name=registry_name, task_run_name=task_run_name, task_run=task_run, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('TaskRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -249,64 +469,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + task_run_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + task_run_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified task run resource. :param resource_group_name: The name of the resource group to which the container registry @@ -318,15 +528,17 @@ def begin_delete( :type task_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +553,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,56 +572,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - update_parameters, # type: "_models.TaskRunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.TaskRun" + resource_group_name: str, + registry_name: str, + task_run_name: str, + update_parameters: "_models.TaskRunUpdateParameters", + **kwargs: Any + ) -> "_models.TaskRun": cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRun"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(update_parameters, 'TaskRunUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_parameters, 'TaskRunUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('TaskRun', pipeline_response) @@ -429,17 +622,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - update_parameters, # type: "_models.TaskRunUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.TaskRun"] + resource_group_name: str, + registry_name: str, + task_run_name: str, + update_parameters: "_models.TaskRunUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.TaskRun"]: """Updates a task run with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -450,18 +645,23 @@ def begin_update( :param task_run_name: The name of the task run. :type task_run_name: str :param update_parameters: The parameters for updating a task run. - :type update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunUpdateParameters + :type update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,28 +674,21 @@ def begin_update( registry_name=registry_name, task_run_name=task_run_name, update_parameters=update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('TaskRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -507,16 +700,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} # type: ignore + @distributed_trace def get_details( self, - resource_group_name, # type: str - registry_name, # type: str - task_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TaskRun" + resource_group_name: str, + registry_name: str, + task_run_name: str, + **kwargs: Any + ) -> "_models.TaskRun": """Gets the detailed information for a given task run that includes all secrets. :param resource_group_name: The name of the resource group to which the container registry @@ -536,34 +730,24 @@ def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TaskRun', pipeline_response) @@ -572,15 +756,17 @@ def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TaskRunListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TaskRunListResult"]: """Lists all the task runs for a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -590,7 +776,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskRunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskRunListResult"] @@ -598,36 +785,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TaskRunListResult', pipeline_response) + deserialized = self._deserialize("TaskRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -640,12 +824,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py index c4dd99415e69..1744279f75af 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py @@ -5,25 +5,266 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_details_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "taskName": _SERIALIZER.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TasksOperations(object): """TasksOperations operations. @@ -47,13 +288,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TaskListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TaskListResult"]: """Lists all the tasks for a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -63,7 +304,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TaskListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TaskListResult"] @@ -71,36 +313,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TaskListResult', pipeline_response) + deserialized = self._deserialize("TaskListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +352,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> "_models.Task": """Get the properties of a specified task. :param resource_group_name: The name of the resource group to which the container registry @@ -151,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Task', pipeline_response) @@ -187,56 +417,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_create_parameters, # type: "_models.Task" - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + task_create_parameters: "_models.Task", + **kwargs: Any + ) -> "_models.Task": cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(task_create_parameters, 'Task') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_create_parameters, 'Task') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Task', pipeline_response) @@ -248,17 +468,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_create_parameters, # type: "_models.Task" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Task"] + resource_group_name: str, + registry_name: str, + task_name: str, + task_create_parameters: "_models.Task", + **kwargs: Any + ) -> LROPoller["_models.Task"]: """Creates a task for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -272,15 +494,19 @@ def begin_create( :type task_create_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +519,21 @@ def begin_create( registry_name=registry_name, task_name=task_name, task_create_parameters=task_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,64 +545,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified task. :param resource_group_name: The name of the resource group to which the container registry @@ -395,15 +604,17 @@ def begin_delete( :type task_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,22 +629,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -445,56 +648,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_update_parameters, # type: "_models.TaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + task_update_parameters: "_models.TaskUpdateParameters", + **kwargs: Any + ) -> "_models.Task": cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(task_update_parameters, 'TaskUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Task', pipeline_response) @@ -506,17 +698,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - task_update_parameters, # type: "_models.TaskUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Task"] + resource_group_name: str, + registry_name: str, + task_name: str, + task_update_parameters: "_models.TaskUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Task"]: """Updates a task with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -527,18 +721,23 @@ def begin_update( :param task_name: The name of the container registry task. :type task_name: str :param task_update_parameters: The parameters for updating a task. - :type task_update_parameters: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskUpdateParameters + :type task_update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Task or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Task"] lro_delay = kwargs.pop( 'polling_interval', @@ -551,28 +750,21 @@ def begin_update( registry_name=registry_name, task_name=task_name, task_update_parameters=task_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Task', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -584,16 +776,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'} # type: ignore + @distributed_trace def get_details( self, - resource_group_name, # type: str - registry_name, # type: str - task_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Task" + resource_group_name: str, + registry_name: str, + task_name: str, + **kwargs: Any + ) -> "_models.Task": """Returns a task with extended information that includes all secrets. :param resource_group_name: The name of the resource group to which the container registry @@ -613,34 +806,24 @@ def get_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'taskName': self._serialize.url("task_name", task_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + task_name=task_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Task', pipeline_response) @@ -649,4 +832,6 @@ def get_details( return cls(pipeline_response, deserialized, {}) return deserialized + get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py index 1122409b784d..7ec79872d18d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py index e868c8db514e..906dc867fa62 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py @@ -6,109 +6,106 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import WebhooksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2019_12_01_preview.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2019_12_01_preview.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_12_01_preview.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_12_01_preview.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2019_12_01_preview.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2019_12_01_preview.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2019_12_01_preview.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2019_12_01_preview.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2019_12_01_preview.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2019_12_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2019_12_01_preview.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2019_12_01_preview.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2019_12_01_preview.operations.ReplicationsOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2019_12_01_preview.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2019_12_01_preview.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_metadata.json index 45b7aa6c1345..891088c7a8d1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "export_pipelines": "ExportPipelinesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_configuration.py index f9e03910cd6b..e53065ca3a50 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_container_registry_management_client.py index 5060b3732738..720c9996c696 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_container_registry_management_client.py @@ -6,105 +6,106 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import WebhooksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.ReplicationsOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2019_12_01_preview.aio.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_export_pipelines_operations.py index d586fe9647cd..71d455e401d3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_export_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._export_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_import_pipelines_operations.py index b8d0a472f4c6..dd8bab60d4ca 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_import_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._import_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_operations.py index 7d5c85d82eeb..11b17bd43460 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_pipeline_runs_operations.py index 308f02123573..d2f5d30495f5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_pipeline_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._pipeline_runs_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_private_endpoint_connections_operations.py index 3d0b42055549..7aa01239db23 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -184,18 +175,24 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,28 +205,21 @@ async def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,6 +231,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -255,26 +246,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,6 +270,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -305,15 +290,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -328,22 +315,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,8 +334,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -371,8 +352,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -380,36 +363,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -427,6 +407,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_registries_operations.py index 17c3d3517db7..ebbc0189c7a7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_get_request, build_import_image_request_initial, build_list_by_resource_group_request, build_list_credentials_request, build_list_private_link_resources_request, build_list_request, build_list_usages_request, build_regenerate_credential_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,30 +60,22 @@ async def _import_image_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -91,6 +88,8 @@ async def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace_async async def begin_import_image( self, resource_group_name: str, @@ -107,18 +106,22 @@ async def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -130,24 +133,18 @@ async def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -159,8 +156,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace_async async def check_name_availability( self, registry_name_check_request: "_models.RegistryNameCheckRequest", @@ -171,7 +170,8 @@ async def check_name_availability( :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryNameStatus @@ -182,30 +182,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,8 +209,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -244,27 +237,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,8 +261,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -292,32 +277,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry, 'Registry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -335,8 +310,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -355,15 +333,20 @@ async def begin_create( :type registry: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -375,27 +358,21 @@ async def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,6 +384,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _delete_initial( @@ -420,25 +398,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -451,6 +421,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -466,15 +438,17 @@ async def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -488,21 +462,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,6 +481,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _update_initial( @@ -528,32 +496,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -571,8 +529,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -588,18 +549,24 @@ async def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -611,27 +578,21 @@ async def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -643,8 +604,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -657,7 +620,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -665,35 +629,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -711,11 +671,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -724,7 +686,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -732,34 +695,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -777,11 +735,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace_async async def list_credentials( self, resource_group_name: str, @@ -805,27 +765,17 @@ async def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,8 +789,11 @@ async def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace_async async def regenerate_credential( self, resource_group_name: str, @@ -857,7 +810,8 @@ async def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListCredentialsResult @@ -868,32 +822,22 @@ async def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -907,8 +851,11 @@ async def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace_async async def list_usages( self, resource_group_name: str, @@ -932,27 +879,17 @@ async def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -966,8 +903,11 @@ async def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, resource_group_name: str, @@ -982,8 +922,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -991,36 +933,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1038,6 +977,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_replications_operations.py index 867b17862bbf..fef4c25a952f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_replications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._replications_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,20 @@ async def begin_create( :type replication: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +203,21 @@ async def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +229,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _delete_initial( @@ -254,26 +244,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +268,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +288,17 @@ async def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +313,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +332,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _update_initial( @@ -369,33 +348,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +382,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +405,24 @@ async def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +435,21 @@ async def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -506,8 +479,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_webhooks_operations.py index 78dc368552d1..8a3d8f3155e3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/aio/operations/_webhooks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._webhooks_operations import build_create_request_initial, build_delete_request_initial, build_get_callback_config_request, build_get_request, build_list_events_request, build_list_request, build_ping_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace_async async def ping( self, resource_group_name: str, @@ -593,28 +567,18 @@ async def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +592,11 @@ async def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace_async async def get_callback_config( self, resource_group_name: str, @@ -656,28 +623,18 @@ async def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -691,8 +648,11 @@ async def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, resource_group_name: str, @@ -711,7 +671,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -719,37 +680,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -767,6 +726,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py index 0ad9f8810297..103eeff5f15a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py @@ -6,160 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Actor - from ._models_py3 import CallbackConfig - from ._models_py3 import EncryptionProperty - from ._models_py3 import Event - from ._models_py3 import EventContent - from ._models_py3 import EventInfo - from ._models_py3 import EventListResult - from ._models_py3 import EventRequestMessage - from ._models_py3 import EventResponseMessage - from ._models_py3 import ExportPipeline - from ._models_py3 import ExportPipelineListResult - from ._models_py3 import ExportPipelineTargetProperties - from ._models_py3 import IPRule - from ._models_py3 import IdentityProperties - from ._models_py3 import ImportImageParameters - from ._models_py3 import ImportPipeline - from ._models_py3 import ImportPipelineListResult - from ._models_py3 import ImportPipelineSourceProperties - from ._models_py3 import ImportSource - from ._models_py3 import ImportSourceCredentials - from ._models_py3 import KeyVaultProperties - from ._models_py3 import NetworkRuleSet - from ._models_py3 import OperationDefinition - from ._models_py3 import OperationDisplayDefinition - from ._models_py3 import OperationListResult - from ._models_py3 import OperationLogSpecificationDefinition - from ._models_py3 import OperationMetricSpecificationDefinition - from ._models_py3 import OperationServiceSpecificationDefinition - from ._models_py3 import PipelineRun - from ._models_py3 import PipelineRunListResult - from ._models_py3 import PipelineRunRequest - from ._models_py3 import PipelineRunResponse - from ._models_py3 import PipelineRunSourceProperties - from ._models_py3 import PipelineRunTargetProperties - from ._models_py3 import PipelineSourceTriggerDescriptor - from ._models_py3 import PipelineSourceTriggerProperties - from ._models_py3 import PipelineTriggerDescriptor - from ._models_py3 import PipelineTriggerProperties - from ._models_py3 import Policies - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProgressProperties - from ._models_py3 import ProxyResource - from ._models_py3 import QuarantinePolicy - from ._models_py3 import RegenerateCredentialParameters - from ._models_py3 import Registry - from ._models_py3 import RegistryListCredentialsResult - from ._models_py3 import RegistryListResult - from ._models_py3 import RegistryNameCheckRequest - from ._models_py3 import RegistryNameStatus - from ._models_py3 import RegistryPassword - from ._models_py3 import RegistryUpdateParameters - from ._models_py3 import RegistryUsage - from ._models_py3 import RegistryUsageListResult - from ._models_py3 import Replication - from ._models_py3 import ReplicationListResult - from ._models_py3 import ReplicationUpdateParameters - from ._models_py3 import Request - from ._models_py3 import Resource - from ._models_py3 import RetentionPolicy - from ._models_py3 import Sku - from ._models_py3 import Source - from ._models_py3 import Status - from ._models_py3 import SystemData - from ._models_py3 import Target - from ._models_py3 import TrustPolicy - from ._models_py3 import UserIdentityProperties - from ._models_py3 import VirtualNetworkRule - from ._models_py3 import Webhook - from ._models_py3 import WebhookCreateParameters - from ._models_py3 import WebhookListResult - from ._models_py3 import WebhookUpdateParameters -except (SyntaxError, ImportError): - from ._models import Actor # type: ignore - from ._models import CallbackConfig # type: ignore - from ._models import EncryptionProperty # type: ignore - from ._models import Event # type: ignore - from ._models import EventContent # type: ignore - from ._models import EventInfo # type: ignore - from ._models import EventListResult # type: ignore - from ._models import EventRequestMessage # type: ignore - from ._models import EventResponseMessage # type: ignore - from ._models import ExportPipeline # type: ignore - from ._models import ExportPipelineListResult # type: ignore - from ._models import ExportPipelineTargetProperties # type: ignore - from ._models import IPRule # type: ignore - from ._models import IdentityProperties # type: ignore - from ._models import ImportImageParameters # type: ignore - from ._models import ImportPipeline # type: ignore - from ._models import ImportPipelineListResult # type: ignore - from ._models import ImportPipelineSourceProperties # type: ignore - from ._models import ImportSource # type: ignore - from ._models import ImportSourceCredentials # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import OperationDefinition # type: ignore - from ._models import OperationDisplayDefinition # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationLogSpecificationDefinition # type: ignore - from ._models import OperationMetricSpecificationDefinition # type: ignore - from ._models import OperationServiceSpecificationDefinition # type: ignore - from ._models import PipelineRun # type: ignore - from ._models import PipelineRunListResult # type: ignore - from ._models import PipelineRunRequest # type: ignore - from ._models import PipelineRunResponse # type: ignore - from ._models import PipelineRunSourceProperties # type: ignore - from ._models import PipelineRunTargetProperties # type: ignore - from ._models import PipelineSourceTriggerDescriptor # type: ignore - from ._models import PipelineSourceTriggerProperties # type: ignore - from ._models import PipelineTriggerDescriptor # type: ignore - from ._models import PipelineTriggerProperties # type: ignore - from ._models import Policies # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProgressProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QuarantinePolicy # type: ignore - from ._models import RegenerateCredentialParameters # type: ignore - from ._models import Registry # type: ignore - from ._models import RegistryListCredentialsResult # type: ignore - from ._models import RegistryListResult # type: ignore - from ._models import RegistryNameCheckRequest # type: ignore - from ._models import RegistryNameStatus # type: ignore - from ._models import RegistryPassword # type: ignore - from ._models import RegistryUpdateParameters # type: ignore - from ._models import RegistryUsage # type: ignore - from ._models import RegistryUsageListResult # type: ignore - from ._models import Replication # type: ignore - from ._models import ReplicationListResult # type: ignore - from ._models import ReplicationUpdateParameters # type: ignore - from ._models import Request # type: ignore - from ._models import Resource # type: ignore - from ._models import RetentionPolicy # type: ignore - from ._models import Sku # type: ignore - from ._models import Source # type: ignore - from ._models import Status # type: ignore - from ._models import SystemData # type: ignore - from ._models import Target # type: ignore - from ._models import TrustPolicy # type: ignore - from ._models import UserIdentityProperties # type: ignore - from ._models import VirtualNetworkRule # type: ignore - from ._models import Webhook # type: ignore - from ._models import WebhookCreateParameters # type: ignore - from ._models import WebhookListResult # type: ignore - from ._models import WebhookUpdateParameters # type: ignore +from ._models_py3 import Actor +from ._models_py3 import CallbackConfig +from ._models_py3 import EncryptionProperty +from ._models_py3 import Event +from ._models_py3 import EventContent +from ._models_py3 import EventInfo +from ._models_py3 import EventListResult +from ._models_py3 import EventRequestMessage +from ._models_py3 import EventResponseMessage +from ._models_py3 import ExportPipeline +from ._models_py3 import ExportPipelineListResult +from ._models_py3 import ExportPipelineTargetProperties +from ._models_py3 import IPRule +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportImageParameters +from ._models_py3 import ImportPipeline +from ._models_py3 import ImportPipelineListResult +from ._models_py3 import ImportPipelineSourceProperties +from ._models_py3 import ImportSource +from ._models_py3 import ImportSourceCredentials +from ._models_py3 import KeyVaultProperties +from ._models_py3 import NetworkRuleSet +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import OperationLogSpecificationDefinition +from ._models_py3 import OperationMetricSpecificationDefinition +from ._models_py3 import OperationServiceSpecificationDefinition +from ._models_py3 import PipelineRun +from ._models_py3 import PipelineRunListResult +from ._models_py3 import PipelineRunRequest +from ._models_py3 import PipelineRunResponse +from ._models_py3 import PipelineRunSourceProperties +from ._models_py3 import PipelineRunTargetProperties +from ._models_py3 import PipelineSourceTriggerDescriptor +from ._models_py3 import PipelineSourceTriggerProperties +from ._models_py3 import PipelineTriggerDescriptor +from ._models_py3 import PipelineTriggerProperties +from ._models_py3 import Policies +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProgressProperties +from ._models_py3 import ProxyResource +from ._models_py3 import QuarantinePolicy +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import RegistryUsage +from ._models_py3 import RegistryUsageListResult +from ._models_py3 import Replication +from ._models_py3 import ReplicationListResult +from ._models_py3 import ReplicationUpdateParameters +from ._models_py3 import Request +from ._models_py3 import Resource +from ._models_py3 import RetentionPolicy +from ._models_py3 import Sku +from ._models_py3 import Source +from ._models_py3 import Status +from ._models_py3 import SystemData +from ._models_py3 import Target +from ._models_py3 import TrustPolicy +from ._models_py3 import UserIdentityProperties +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import Webhook +from ._models_py3 import WebhookCreateParameters +from ._models_py3 import WebhookListResult +from ._models_py3 import WebhookUpdateParameters + from ._container_registry_management_client_enums import ( Action, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py index 444a52f88315..6096c5ae7df0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py @@ -6,40 +6,25 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Action(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action of virtual network rule. """ ALLOW = "Allow" -class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" RECREATE = "Recreate" -class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private link service connection status. """ @@ -48,7 +33,7 @@ class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -57,21 +42,21 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class EncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether or not the encryption is enabled for container registry. """ ENABLED = "enabled" DISABLED = "disabled" -class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImportMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. """ @@ -79,7 +64,7 @@ class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NO_FORCE = "NoForce" FORCE = "Force" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -88,53 +73,53 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to allow trusted Azure services to access a network restricted registry. """ AZURE_SERVICES = "AzureServices" NONE = "None" -class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name. """ PASSWORD = "password" PASSWORD2 = "password2" -class PipelineOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OVERWRITE_TAGS = "OverwriteTags" OVERWRITE_BLOBS = "OverwriteBlobs" DELETE_SOURCE_BLOB_ON_SUCCESS = "DeleteSourceBlobOnSuccess" CONTINUE_ON_ERRORS = "ContinueOnErrors" -class PipelineRunSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the source. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineRunTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunTargetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the target. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source for the import pipeline. """ AZURE_STORAGE_BLOB_CONTAINER = "AzureStorageBlobContainer" -class PolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the pipeline at the time the operation was called. """ @@ -145,21 +130,21 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not public network access is allowed for the container registry. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RegistryUsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegistryUsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement. """ COUNT = "Count" BYTES = "Bytes" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -168,7 +153,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name of the container registry. Required for registry creation. """ @@ -177,7 +162,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier based on the SKU name. """ @@ -186,20 +171,20 @@ class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the source trigger. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TrustPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrustPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of trust policy. """ NOTARY = "Notary" -class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PUSH = "push" DELETE = "delete" @@ -207,7 +192,7 @@ class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CHART_PUSH = "chart_push" CHART_DELETE = "chart_delete" -class WebhookStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the webhook at the time the operation was called. """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py deleted file mode 100644 index 01721f7f2a21..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py +++ /dev/null @@ -1,2665 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Actor(msrest.serialization.Model): - """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - - :param name: The subject or username associated with the request context that generated the - event. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Actor, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class CallbackConfig(msrest.serialization.Model): - """The configuration of service URI and custom headers for the webhook. - - All required parameters must be populated in order to send to Azure. - - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - """ - - _validation = { - 'service_uri': {'required': True}, - } - - _attribute_map = { - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(CallbackConfig, self).__init__(**kwargs) - self.service_uri = kwargs['service_uri'] - self.custom_headers = kwargs.get('custom_headers', None) - - -class EncryptionProperty(msrest.serialization.Model): - """EncryptionProperty. - - :param status: Indicates whether or not the encryption is enabled for container registry. - Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.KeyVaultProperties - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProperty, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EventInfo(msrest.serialization.Model): - """The basic information of an event. - - :param id: The event ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventInfo, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Event(EventInfo): - """The event for a webhook. - - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventResponseMessage - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, - 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.event_request_message = kwargs.get('event_request_message', None) - self.event_response_message = kwargs.get('event_response_message', None) - - -class EventContent(msrest.serialization.Model): - """The content of the event request message. - - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the - authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor - initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Source - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'action': {'key': 'action', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'Target'}, - 'request': {'key': 'request', 'type': 'Request'}, - 'actor': {'key': 'actor', 'type': 'Actor'}, - 'source': {'key': 'source', 'type': 'Source'}, - } - - def __init__( - self, - **kwargs - ): - super(EventContent, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.action = kwargs.get('action', None) - self.target = kwargs.get('target', None) - self.request = kwargs.get('request', None) - self.actor = kwargs.get('actor', None) - self.source = kwargs.get('source', None) - - -class EventListResult(msrest.serialization.Model): - """The result of a request to list events for a webhook. - - :param value: The list of events. Since this list may be incomplete, the nextLink field should - be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventRequestMessage(msrest.serialization.Model): - """The event request message sent to the service URI. - - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'EventContent'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'method': {'key': 'method', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventRequestMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.method = kwargs.get('method', None) - self.request_uri = kwargs.get('request_uri', None) - self.version = kwargs.get('version', None) - - -class EventResponseMessage(msrest.serialization.Model): - """The event response message received from the service URI. - - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventResponseMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.reason_phrase = kwargs.get('reason_phrase', None) - self.status_code = kwargs.get('status_code', None) - self.version = kwargs.get('version', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ExportPipeline(ProxyResource): - """An object that represents an export pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'target': {'key': 'properties.target', 'type': 'ExportPipelineTargetProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.target = kwargs.get('target', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ExportPipelineListResult(msrest.serialization.Model): - """The result of a request to list export pipelines for a container registry. - - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExportPipelineTargetProperties(msrest.serialization.Model): - """The properties of the export pipeline target. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class IdentityProperties(msrest.serialization.Model): - """Managed identity for the resource. - - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", "None". - :type type: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity - dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.UserIdentityProperties] - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImportImageParameters(msrest.serialization.Model): - """ImportImageParameters. - - All required parameters must be populated in order to send to Azure. - - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will - be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only - copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any - existing target tags will fail the operation before any copying begins. Possible values - include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportMode - """ - - _validation = { - 'source': {'required': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'ImportSource'}, - 'target_tags': {'key': 'targetTags', 'type': '[str]'}, - 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportImageParameters, self).__init__(**kwargs) - self.source = kwargs['source'] - self.target_tags = kwargs.get('target_tags', None) - self.untagged_target_repositories = kwargs.get('untagged_target_repositories', None) - self.mode = kwargs.get('mode', "NoForce") - - -class ImportPipeline(ProxyResource): - """An object that represents an import pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'source': {'key': 'properties.source', 'type': 'ImportPipelineSourceProperties'}, - 'trigger': {'key': 'properties.trigger', 'type': 'PipelineTriggerProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.source = kwargs.get('source', None) - self.trigger = kwargs.get('trigger', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ImportPipelineListResult(msrest.serialization.Model): - """The result of a request to list import pipelines for a container registry. - - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ImportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ImportPipelineSourceProperties(msrest.serialization.Model): - """The properties of the import pipeline source. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of source for the import pipeline. Possible values include: - "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlobContainer") - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class ImportSource(msrest.serialization.Model): - """ImportSource. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str - """ - - _validation = { - 'source_image': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'registry_uri': {'key': 'registryUri', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, - 'source_image': {'key': 'sourceImage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSource, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.registry_uri = kwargs.get('registry_uri', None) - self.credentials = kwargs.get('credentials', None) - self.source_image = kwargs['source_image'] - - -class ImportSourceCredentials(msrest.serialization.Model): - """ImportSourceCredentials. - - All required parameters must be populated in order to send to Azure. - - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str - """ - - _validation = { - 'password': {'required': True}, - } - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSourceCredentials, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs['password'] - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.ip_address_or_range = kwargs['ip_address_or_range'] - - -class KeyVaultProperties(msrest.serialization.Model): - """KeyVaultProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str - :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of - the key that is actually used for encryption. - :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str - :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. - :vartype key_rotation_enabled: bool - :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'versioned_key_identifier': {'readonly': True}, - 'key_rotation_enabled': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'versioned_key_identifier': {'key': 'versionedKeyIdentifier', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'str'}, - 'key_rotation_enabled': {'key': 'keyRotationEnabled', 'type': 'bool'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_identifier = kwargs.get('key_identifier', None) - self.versioned_key_identifier = None - self.identity = kwargs.get('identity', None) - self.key_rotation_enabled = None - self.last_key_rotation_timestamp = None - - -class NetworkRuleSet(msrest.serialization.Model): - """The network rule set for a container registry. - - All required parameters must be populated in order to send to Azure. - - :param default_action: Required. The default action of allow or deny when no other rules match. - Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.IPRule] - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', "Allow") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - - -class OperationDefinition(msrest.serialization.Model): - """The definition of a container registry operation. - - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationServiceSpecificationDefinition - """ - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDefinition, self).__init__(**kwargs) - self.origin = kwargs.get('origin', None) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplayDefinition(msrest.serialization.Model): - """The display information for a container registry operation. - - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The result of a request to list container registry operations. - - :param value: The list of container registry operations. Since this list may be incomplete, the - nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry - operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationLogSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring log. - - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationLogSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class OperationMetricSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring metric. - - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class OperationServiceSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring list. - - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: - list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: - list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationLogSpecificationDefinition] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, - 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecificationDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - self.log_specifications = kwargs.get('log_specifications', None) - - -class PipelineRun(ProxyResource): - """An object that represents a pipeline run for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of a pipeline run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunRequest - :ivar response: The response of a pipeline run. - :vartype response: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline - run configuration has not changed. - :type force_update_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'request': {'key': 'properties.request', 'type': 'PipelineRunRequest'}, - 'response': {'key': 'properties.response', 'type': 'PipelineRunResponse'}, - 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRun, self).__init__(**kwargs) - self.provisioning_state = None - self.request = kwargs.get('request', None) - self.response = None - self.force_update_tag = kwargs.get('force_update_tag', None) - - -class PipelineRunListResult(msrest.serialization.Model): - """The result of a request to list pipeline runs for a container registry. - - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field - should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PipelineRun]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PipelineRunRequest(msrest.serialization.Model): - """The request properties provided for a pipeline run. - - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - """ - - _attribute_map = { - 'pipeline_resource_id': {'key': 'pipelineResourceId', 'type': 'str'}, - 'artifacts': {'key': 'artifacts', 'type': '[str]'}, - 'source': {'key': 'source', 'type': 'PipelineRunSourceProperties'}, - 'target': {'key': 'target', 'type': 'PipelineRunTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunRequest, self).__init__(**kwargs) - self.pipeline_resource_id = kwargs.get('pipeline_resource_id', None) - self.artifacts = kwargs.get('artifacts', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - - -class PipelineRunResponse(msrest.serialization.Model): - """The response properties returned for a pipeline run. - - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case - of failure. - :type pipeline_run_error_message: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'imported_artifacts': {'key': 'importedArtifacts', 'type': '[str]'}, - 'progress': {'key': 'progress', 'type': 'ProgressProperties'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'source': {'key': 'source', 'type': 'ImportPipelineSourceProperties'}, - 'target': {'key': 'target', 'type': 'ExportPipelineTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - 'trigger': {'key': 'trigger', 'type': 'PipelineTriggerDescriptor'}, - 'pipeline_run_error_message': {'key': 'pipelineRunErrorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunResponse, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.imported_artifacts = kwargs.get('imported_artifacts', None) - self.progress = kwargs.get('progress', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - self.trigger = kwargs.get('trigger', None) - self.pipeline_run_error_message = kwargs.get('pipeline_run_error_message', None) - - -class PipelineRunSourceProperties(msrest.serialization.Model): - """PipelineRunSourceProperties. - - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineRunTargetProperties(msrest.serialization.Model): - """PipelineRunTargetProperties. - - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineSourceTriggerDescriptor(msrest.serialization.Model): - """PipelineSourceTriggerDescriptor. - - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime - """ - - _attribute_map = { - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) - self.timestamp = kwargs.get('timestamp', None) - - -class PipelineSourceTriggerProperties(msrest.serialization.Model): - """PipelineSourceTriggerProperties. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The current status of the source trigger. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TriggerStatus - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerProperties, self).__init__(**kwargs) - self.status = kwargs.get('status', "Enabled") - - -class PipelineTriggerDescriptor(msrest.serialization.Model): - """PipelineTriggerDescriptor. - - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceTriggerDescriptor - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerDescriptor'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerDescriptor, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class PipelineTriggerProperties(msrest.serialization.Model): - """PipelineTriggerProperties. - - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceTriggerProperties - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerProperties, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class Policies(msrest.serialization.Model): - """The policies for a container registry. - - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RetentionPolicy - """ - - _attribute_map = { - 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, - 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(Policies, self).__init__(**kwargs) - self.quarantine_policy = kwargs.get('quarantine_policy', None) - self.trust_policy = kwargs.get('trust_policy', None) - self.retention_policy = kwargs.get('retention_policy', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateEndpointConnection(ProxyResource): - """An object that represents a private endpoint connection for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of private endpoint connection resource. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """The result of a request to list private endpoint connections for a container registry. - - :param value: The list of private endpoint connections. Since this list may be incomplete, the - nextLink field should be used to request the next list of private endpoint connections. - :type value: - list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint - connections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(msrest.serialization.Model): - """A resource that supports private link capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The resource type is private link resource. - :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'type': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.type = None - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.group_id = kwargs.get('group_id', None) - self.required_members = kwargs.get('required_members', None) - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """The result of a request to list private link resources for a container registry. - - :param value: The list of private link resources. Since this list may be incomplete, the - nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The state of a private link service connection. - - :param status: The private link service connection status. Possible values include: "Approved", - "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ProgressProperties(msrest.serialization.Model): - """ProgressProperties. - - :param percentage: The percentage complete of the copy operation. - :type percentage: str - """ - - _attribute_map = { - 'percentage': {'key': 'percentage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProgressProperties, self).__init__(**kwargs) - self.percentage = kwargs.get('percentage', None) - - -class QuarantinePolicy(msrest.serialization.Model): - """The quarantine policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuarantinePolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - - -class RegenerateCredentialParameters(msrest.serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateCredentialParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.system_data = None - - -class Registry(Resource): - """An object that represents a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties - :ivar login_server: The URL that can be used to log into the container registry. - :vartype login_server: str - :ivar creation_date: The creation date of the container registry in ISO8601 format. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the container registry at the time the - operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", - "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - :ivar status: The status of the container registry at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :ivar data_endpoint_host_names: List of host names that will serve data when - dataEndpointEnabled is true. - :vartype data_endpoint_host_names: list[str] - :ivar private_endpoint_connections: List of private endpoint connections for a container - registry. - :vartype private_endpoint_connections: - list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleBypassOptions - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'sku': {'required': True}, - 'login_server': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'data_endpoint_host_names': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'data_endpoint_host_names': {'key': 'properties.dataEndpointHostNames', 'type': '[str]'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Registry, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.identity = kwargs.get('identity', None) - self.login_server = None - self.creation_date = None - self.provisioning_state = None - self.status = None - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.data_endpoint_host_names = None - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - - -class RegistryListCredentialsResult(msrest.serialization.Model): - """The response from the ListCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: - list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class RegistryListResult(msrest.serialization.Model): - """The result of a request to list container registries. - - :param value: The list of container registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Registry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegistryNameCheckRequest(msrest.serialization.Model): - """A request to check whether a container registry name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the container registry. - :type name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Has constant value: - "Microsoft.ContainerRegistry/registries". - :vartype type: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - **kwargs - ): - super(RegistryNameCheckRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class RegistryNameStatus(msrest.serialization.Model): - """The result of a request to check the availability of a container registry name. - - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryNameStatus, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class RegistryPassword(msrest.serialization.Model): - """The login password for the container registry. - - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName - :param value: The password value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPassword, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class RegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a container registry. - - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleBypassOptions - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUpdateParameters, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.admin_user_enabled = kwargs.get('admin_user_enabled', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - - -class RegistryUsage(msrest.serialization.Model): - """The quota usage for a container registry. - - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsageUnit - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsage, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.limit = kwargs.get('limit', None) - self.current_value = kwargs.get('current_value', None) - self.unit = kwargs.get('unit', None) - - -class RegistryUsageListResult(msrest.serialization.Model): - """The result of a request to get container registry quota usages. - - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RegistryUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Replication(Resource): - """An object that represents a replication for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of the replication at the time the operation - was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - :ivar status: The status of the replication at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Replication, self).__init__(**kwargs) - self.provisioning_state = None - self.status = None - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', True) - - -class ReplicationListResult(msrest.serialization.Model): - """The result of a request to list replications for a container registry. - - :param value: The list of replications. Since this list may be incomplete, the nextLink field - should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Replication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationUpdateParameters(msrest.serialization.Model): - """The parameters for updating a replication. - - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', None) - - -class Request(msrest.serialization.Model): - """The request that generated the event. - - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the - event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the - http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'addr': {'key': 'addr', 'type': 'str'}, - 'host': {'key': 'host', 'type': 'str'}, - 'method': {'key': 'method', 'type': 'str'}, - 'useragent': {'key': 'useragent', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.addr = kwargs.get('addr', None) - self.host = kwargs.get('host', None) - self.method = kwargs.get('method', None) - self.useragent = kwargs.get('useragent', None) - - -class RetentionPolicy(msrest.serialization.Model): - """The retention policy for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int - :ivar last_updated_time: The timestamp when the policy was last updated. - :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus - """ - - _validation = { - 'last_updated_time': {'readonly': True}, - } - - _attribute_map = { - 'days': {'key': 'days', 'type': 'int'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RetentionPolicy, self).__init__(**kwargs) - self.days = kwargs.get('days', 7) - self.last_updated_time = None - self.status = kwargs.get('status', None) - - -class Sku(msrest.serialization.Model): - """The SKU of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name of the container registry. Required for registry creation. - Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SkuName - :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class Source(msrest.serialization.Model): - """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - - :param addr: The IP or hostname and the port of the registry node that generated the event. - Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str - """ - - _attribute_map = { - 'addr': {'key': 'addr', 'type': 'str'}, - 'instance_id': {'key': 'instanceID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Source, self).__init__(**kwargs) - self.addr = kwargs.get('addr', None) - self.instance_id = kwargs.get('instance_id', None) - - -class Status(msrest.serialization.Model): - """The status of an Azure resource at the time the operation was called. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_status: The short label for the status. - :vartype display_status: str - :ivar message: The detailed message for the status, including alerts and error messages. - :vartype message: str - :ivar timestamp: The timestamp when the status was changed to the current value. - :vartype timestamp: ~datetime.datetime - """ - - _validation = { - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'timestamp': {'readonly': True}, - } - - _attribute_map = { - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Status, self).__init__(**kwargs) - self.display_status = None - self.message = None - self.timestamp = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Target(msrest.serialization.Model): - """The target of the event. - - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str - """ - - _attribute_map = { - 'media_type': {'key': 'mediaType', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'long'}, - 'digest': {'key': 'digest', 'type': 'str'}, - 'length': {'key': 'length', 'type': 'long'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Target, self).__init__(**kwargs) - self.media_type = kwargs.get('media_type', None) - self.size = kwargs.get('size', None) - self.digest = kwargs.get('digest', None) - self.length = kwargs.get('length', None) - self.repository = kwargs.get('repository', None) - self.url = kwargs.get('url', None) - self.tag = kwargs.get('tag', None) - self.name = kwargs.get('name', None) - self.version = kwargs.get('version', None) - - -class TrustPolicy(msrest.serialization.Model): - """The content trust policy for a container registry. - - :param type: The type of trust policy. Possible values include: "Notary". Default value: - "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustPolicy, self).__init__(**kwargs) - self.type = kwargs.get('type', "Notary") - self.status = kwargs.get('status', None) - - -class UserIdentityProperties(msrest.serialization.Model): - """UserIdentityProperties. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual network rule. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - - -class Webhook(Resource): - """An object that represents a webhook for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] - :ivar provisioning_state: The provisioning state of the webhook at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Webhook, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - self.provisioning_state = None - - -class WebhookCreateParameters(msrest.serialization.Model): - """The parameters for creating a webhook. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the - resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - - -class WebhookListResult(msrest.serialization.Model): - """The result of a request to list webhooks for a container registry. - - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Webhook]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WebhookUpdateParameters(msrest.serialization.Model): - """The parameters for updating a webhook. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py index d2a925031c55..37d62cc3c820 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py @@ -17,9 +17,9 @@ class Actor(msrest.serialization.Model): """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :param name: The subject or username associated with the request context that generated the + :ivar name: The subject or username associated with the request context that generated the event. - :type name: str + :vartype name: str """ _attribute_map = { @@ -32,6 +32,11 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The subject or username associated with the request context that generated the + event. + :paramtype name: str + """ super(Actor, self).__init__(**kwargs) self.name = name @@ -41,10 +46,10 @@ class CallbackConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] + :ivar service_uri: Required. The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] """ _validation = { @@ -63,6 +68,12 @@ def __init__( custom_headers: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword service_uri: Required. The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + """ super(CallbackConfig, self).__init__(**kwargs) self.service_uri = service_uri self.custom_headers = custom_headers @@ -71,11 +82,12 @@ def __init__( class EncryptionProperty(msrest.serialization.Model): """EncryptionProperty. - :param status: Indicates whether or not the encryption is enabled for container registry. + :ivar status: Indicates whether or not the encryption is enabled for container registry. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: + :vartype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionStatus + :ivar key_vault_properties: Key vault properties. + :vartype key_vault_properties: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.KeyVaultProperties """ @@ -91,6 +103,15 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionStatus + :keyword key_vault_properties: Key vault properties. + :paramtype key_vault_properties: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.KeyVaultProperties + """ super(EncryptionProperty, self).__init__(**kwargs) self.status = status self.key_vault_properties = key_vault_properties @@ -99,8 +120,8 @@ def __init__( class EventInfo(msrest.serialization.Model): """The basic information of an event. - :param id: The event ID. - :type id: str + :ivar id: The event ID. + :vartype id: str """ _attribute_map = { @@ -113,6 +134,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + """ super(EventInfo, self).__init__(**kwargs) self.id = id @@ -120,13 +145,13 @@ def __init__( class Event(EventInfo): """The event for a webhook. - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: + :ivar id: The event ID. + :vartype id: str + :ivar event_request_message: The event request message sent to the service URI. + :vartype event_request_message: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventResponseMessage """ @@ -144,6 +169,16 @@ def __init__( event_response_message: Optional["EventResponseMessage"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword event_request_message: The event request message sent to the service URI. + :paramtype event_request_message: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventRequestMessage + :keyword event_response_message: The event response message received from the service URI. + :paramtype event_response_message: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventResponseMessage + """ super(Event, self).__init__(id=id, **kwargs) self.event_request_message = event_request_message self.event_response_message = event_response_message @@ -152,22 +187,22 @@ def __init__( class EventContent(msrest.serialization.Model): """The content of the event request message. - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar target: The target of the event. + :vartype target: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Request + :ivar actor: The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor + :vartype actor: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Actor + :ivar source: The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Source + :vartype source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Source """ _attribute_map = { @@ -192,6 +227,24 @@ def __init__( source: Optional["Source"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword timestamp: The time at which the event occurred. + :paramtype timestamp: ~datetime.datetime + :keyword action: The action that encompasses the provided event. + :paramtype action: str + :keyword target: The target of the event. + :paramtype target: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Target + :keyword request: The request that generated the event. + :paramtype request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Request + :keyword actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :paramtype actor: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Actor + :keyword source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :paramtype source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Source + """ super(EventContent, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -205,11 +258,11 @@ def __init__( class EventListResult(msrest.serialization.Model): """The result of a request to list events for a webhook. - :param value: The list of events. Since this list may be incomplete, the nextLink field should + :ivar value: The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Event] + :ivar next_link: The URI that can be used to request the next list of events. + :vartype next_link: str """ _attribute_map = { @@ -224,6 +277,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of events. Since this list may be incomplete, the nextLink field + should be used to request the next list of events. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Event] + :keyword next_link: The URI that can be used to request the next list of events. + :paramtype next_link: str + """ super(EventListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -232,16 +292,16 @@ def __init__( class EventRequestMessage(msrest.serialization.Model): """The event request message sent to the service URI. - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventContent + :ivar headers: The headers of the event request message. + :vartype headers: dict[str, str] + :ivar method: The HTTP method used to send the event request message. + :vartype method: str + :ivar request_uri: The URI used to send the event request message. + :vartype request_uri: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -262,6 +322,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event request message. + :paramtype content: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventContent + :keyword headers: The headers of the event request message. + :paramtype headers: dict[str, str] + :keyword method: The HTTP method used to send the event request message. + :paramtype method: str + :keyword request_uri: The URI used to send the event request message. + :paramtype request_uri: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventRequestMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -273,16 +345,16 @@ def __init__( class EventResponseMessage(msrest.serialization.Model): """The event response message received from the service URI. - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event response message. + :vartype content: str + :ivar headers: The headers of the event response message. + :vartype headers: dict[str, str] + :ivar reason_phrase: The reason phrase of the event response message. + :vartype reason_phrase: str + :ivar status_code: The status code of the event response message. + :vartype status_code: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -303,6 +375,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event response message. + :paramtype content: str + :keyword headers: The headers of the event response message. + :paramtype headers: dict[str, str] + :keyword reason_phrase: The reason phrase of the event response message. + :paramtype reason_phrase: str + :keyword status_code: The status code of the event response message. + :paramtype status_code: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventResponseMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -344,6 +428,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -364,15 +450,15 @@ class ExportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: + :ivar location: The location of the export pipeline. + :vartype location: str + :ivar identity: The identity of the export pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :ivar target: The target properties of the export pipeline. + :vartype target: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -410,6 +496,19 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the export pipeline. + :paramtype location: str + :keyword identity: The identity of the export pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :keyword target: The target properties of the export pipeline. + :paramtype target: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineTargetProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineOptions] + """ super(ExportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -421,11 +520,11 @@ def __init__( class ExportPipelineListResult(msrest.serialization.Model): """The result of a request to list export pipelines for a container registry. - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -440,6 +539,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of export pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of export pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ExportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -450,15 +556,15 @@ class ExportPipelineTargetProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. + :ivar type: The type of target for the export pipeline. + :vartype type: str + :ivar uri: The target uri of the export pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -479,6 +585,17 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of target for the export pipeline. + :paramtype type: str + :keyword uri: The target uri of the export pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + token. + :paramtype key_vault_uri: str + """ super(ExportPipelineTargetProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -488,20 +605,20 @@ def __init__( class IdentityProperties(msrest.serialization.Model): """Managed identity for the resource. - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or + :vartype type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.containerregistry.v2019_12_01_preview.models.UserIdentityProperties] """ @@ -521,6 +638,23 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.UserIdentityProperties] + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id @@ -533,18 +667,18 @@ class ImportImageParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + :ivar source: Required. The source of the image. + :vartype source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportSource + :ivar target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only + :vartype target_tags: list[str] + :ivar untagged_target_repositories: List of strings of repository names to do a manifest only copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + :vartype untagged_target_repositories: list[str] + :ivar mode: When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportMode + :vartype mode: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportMode """ _validation = { @@ -567,6 +701,20 @@ def __init__( mode: Optional[Union[str, "ImportMode"]] = "NoForce", **kwargs ): + """ + :keyword source: Required. The source of the image. + :paramtype source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportSource + :keyword target_tags: List of strings of the form repo[:tag]. When tag is omitted the source + will be used (or 'latest' if source tag is also omitted). + :paramtype target_tags: list[str] + :keyword untagged_target_repositories: List of strings of repository names to do a manifest + only copy. No tag will be created. + :paramtype untagged_target_repositories: list[str] + :keyword mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :paramtype mode: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportMode + """ super(ImportImageParameters, self).__init__(**kwargs) self.source = source self.target_tags = target_tags @@ -587,18 +735,18 @@ class ImportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: + :ivar location: The location of the import pipeline. + :vartype location: str + :ivar identity: The identity of the import pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :ivar source: The source properties of the import pipeline. + :vartype source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: + :ivar trigger: The properties that describe the trigger of the import pipeline. + :vartype trigger: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -638,6 +786,22 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the import pipeline. + :paramtype location: str + :keyword identity: The identity of the import pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :keyword source: The source properties of the import pipeline. + :paramtype source: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineSourceProperties + :keyword trigger: The properties that describe the trigger of the import pipeline. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineTriggerProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineOptions] + """ super(ImportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -650,11 +814,11 @@ def __init__( class ImportPipelineListResult(msrest.serialization.Model): """The result of a request to list import pipelines for a container registry. - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -669,6 +833,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of import pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of import pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ImportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -679,16 +850,17 @@ class ImportPipelineSourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of source for the import pipeline. Possible values include: + :ivar type: The type of source for the import pipeline. Possible values include: "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. + :vartype type: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceType + :ivar uri: The source uri of the import pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -709,6 +881,19 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of source for the import pipeline. Possible values include: + "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceType + :keyword uri: The source uri of the import pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + token. + :paramtype key_vault_uri: str + """ super(ImportPipelineSourceProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -720,18 +905,18 @@ class ImportSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: + :ivar resource_id: The resource identifier of the source Azure Container Registry. + :vartype resource_id: str + :ivar registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :vartype registry_uri: str + :ivar credentials: Credentials used when importing from a registry uri. + :vartype credentials: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. + :ivar source_image: Required. Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str + :vartype source_image: str """ _validation = { @@ -754,6 +939,20 @@ def __init__( credentials: Optional["ImportSourceCredentials"] = None, **kwargs ): + """ + :keyword resource_id: The resource identifier of the source Azure Container Registry. + :paramtype resource_id: str + :keyword registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :paramtype registry_uri: str + :keyword credentials: Credentials used when importing from a registry uri. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportSourceCredentials + :keyword source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype source_image: str + """ super(ImportSource, self).__init__(**kwargs) self.resource_id = resource_id self.registry_uri = registry_uri @@ -766,10 +965,10 @@ class ImportSourceCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: Required. The password used to authenticate with the source registry. + :vartype password: str """ _validation = { @@ -788,6 +987,12 @@ def __init__( username: Optional[str] = None, **kwargs ): + """ + :keyword username: The username to authenticate with the source registry. + :paramtype username: str + :keyword password: Required. The password used to authenticate with the source registry. + :paramtype password: str + """ super(ImportSourceCredentials, self).__init__(**kwargs) self.username = username self.password = password @@ -798,11 +1003,11 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar action: The action of IP ACL rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str + :vartype ip_address_or_range: str """ _validation = { @@ -821,6 +1026,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of IP ACL rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + """ super(IPRule, self).__init__(**kwargs) self.action = action self.ip_address_or_range = ip_address_or_range @@ -831,13 +1043,13 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str + :ivar key_identifier: Key vault uri to access the encryption key. + :vartype key_identifier: str :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of the key that is actually used for encryption. :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str + :ivar identity: The client id of the identity which will be used to access key vault. + :vartype identity: str :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. :vartype key_rotation_enabled: bool :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. @@ -865,6 +1077,12 @@ def __init__( identity: Optional[str] = None, **kwargs ): + """ + :keyword key_identifier: Key vault uri to access the encryption key. + :paramtype key_identifier: str + :keyword identity: The client id of the identity which will be used to access key vault. + :paramtype identity: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_identifier = key_identifier self.versioned_key_identifier = None @@ -878,15 +1096,15 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param default_action: Required. The default action of allow or deny when no other rules match. + :ivar default_action: Required. The default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or + :vartype default_action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: + :ivar virtual_network_rules: The virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.IPRule] + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.IPRule] """ _validation = { @@ -907,6 +1125,17 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword default_action: Required. The default action of allow or deny when no other rules + match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.DefaultAction + :keyword virtual_network_rules: The virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.VirtualNetworkRule] + :keyword ip_rules: The IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.IPRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules @@ -916,15 +1145,15 @@ def __init__( class OperationDefinition(msrest.serialization.Model): """The definition of a container registry operation. - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: + :ivar origin: The origin information of the container registry operation. + :vartype origin: str + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationServiceSpecificationDefinition """ @@ -944,6 +1173,18 @@ def __init__( service_specification: Optional["OperationServiceSpecificationDefinition"] = None, **kwargs ): + """ + :keyword origin: The origin information of the container registry operation. + :paramtype origin: str + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDisplayDefinition + :keyword service_specification: The definition of Azure Monitoring service. + :paramtype service_specification: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationServiceSpecificationDefinition + """ super(OperationDefinition, self).__init__(**kwargs) self.origin = origin self.name = name @@ -954,14 +1195,14 @@ def __init__( class OperationDisplayDefinition(msrest.serialization.Model): """The display information for a container registry operation. - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str """ _attribute_map = { @@ -980,6 +1221,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ super(OperationDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -990,12 +1241,13 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The result of a request to list container registry operations. - :param value: The list of container registry operations. Since this list may be incomplete, the + :ivar value: The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry + :vartype value: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry operations. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1010,6 +1262,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1018,12 +1279,12 @@ def __init__( class OperationLogSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring log. - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str + :ivar name: Log name. + :vartype name: str + :ivar display_name: Log display name. + :vartype display_name: str + :ivar blob_duration: Log blob duration. + :vartype blob_duration: str """ _attribute_map = { @@ -1040,6 +1301,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Log name. + :paramtype name: str + :keyword display_name: Log display name. + :paramtype display_name: str + :keyword blob_duration: Log blob duration. + :paramtype blob_duration: str + """ super(OperationLogSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1049,18 +1318,18 @@ def __init__( class OperationMetricSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring metric. - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str + :ivar name: Metric name. + :vartype name: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -1083,6 +1352,20 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Metric name. + :paramtype name: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword unit: Metric unit. + :paramtype unit: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword internal_metric_name: Internal metric name. + :paramtype internal_metric_name: str + """ super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1095,11 +1378,11 @@ def __init__( class OperationServiceSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring list. - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: + :ivar log_specifications: A list of Azure Monitoring log definitions. + :vartype log_specifications: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationLogSpecificationDefinition] """ @@ -1115,6 +1398,14 @@ def __init__( log_specifications: Optional[List["OperationLogSpecificationDefinition"]] = None, **kwargs ): + """ + :keyword metric_specifications: A list of Azure Monitoring metrics definition. + :paramtype metric_specifications: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationMetricSpecificationDefinition] + :keyword log_specifications: A list of Azure Monitoring log definitions. + :paramtype log_specifications: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationLogSpecificationDefinition] + """ super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -1137,13 +1428,13 @@ class PipelineRun(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunRequest + :ivar request: The request parameters for a pipeline run. + :vartype request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunRequest :ivar response: The response of a pipeline run. :vartype response: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline + :ivar force_update_tag: How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - :type force_update_tag: str + :vartype force_update_tag: str """ _validation = { @@ -1173,6 +1464,13 @@ def __init__( force_update_tag: Optional[str] = None, **kwargs ): + """ + :keyword request: The request parameters for a pipeline run. + :paramtype request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunRequest + :keyword force_update_tag: How the pipeline run should be forced to recreate even if the + pipeline run configuration has not changed. + :paramtype force_update_tag: str + """ super(PipelineRun, self).__init__(**kwargs) self.provisioning_state = None self.request = request @@ -1183,11 +1481,11 @@ def __init__( class PipelineRunListResult(msrest.serialization.Model): """The result of a request to list pipeline runs for a container registry. - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field + :ivar value: The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -1202,6 +1500,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of pipeline runs. Since this list may be incomplete, the nextLink + field should be used to request the next list of pipeline runs. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(PipelineRunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1210,21 +1515,21 @@ def __init__( class PipelineRunRequest(msrest.serialization.Model): """The request properties provided for a pipeline run. - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. + :ivar pipeline_resource_id: The resource ID of the pipeline to run. + :vartype pipeline_resource_id: str + :ivar artifacts: List of source artifacts to be transferred by the pipeline. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: + :vartype artifacts: list[str] + :ivar source: The source properties of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: + :ivar target: The target properties of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str """ _attribute_map = { @@ -1245,6 +1550,23 @@ def __init__( catalog_digest: Optional[str] = None, **kwargs ): + """ + :keyword pipeline_resource_id: The resource ID of the pipeline to run. + :paramtype pipeline_resource_id: str + :keyword artifacts: List of source artifacts to be transferred by the pipeline. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype artifacts: list[str] + :keyword source: The source properties of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunSourceProperties + :keyword target: The target properties of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + """ super(PipelineRunRequest, self).__init__(**kwargs) self.pipeline_resource_id = pipeline_resource_id self.artifacts = artifacts @@ -1256,30 +1578,30 @@ def __init__( class PipelineRunResponse(msrest.serialization.Model): """The response properties returned for a pipeline run. - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: + :ivar status: The current status of the pipeline run. + :vartype status: str + :ivar imported_artifacts: The artifacts imported in the pipeline run. + :vartype imported_artifacts: list[str] + :ivar progress: The current progress of the copy operation. + :vartype progress: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProgressProperties + :ivar start_time: The time the pipeline run started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the pipeline run finished. + :vartype finish_time: ~datetime.datetime + :ivar source: The source of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: + :ivar target: The target of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str + :ivar trigger: The trigger that caused the pipeline run. + :vartype trigger: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case + :ivar pipeline_run_error_message: The detailed error message for the pipeline run in the case of failure. - :type pipeline_run_error_message: str + :vartype pipeline_run_error_message: str """ _attribute_map = { @@ -1310,6 +1632,33 @@ def __init__( pipeline_run_error_message: Optional[str] = None, **kwargs ): + """ + :keyword status: The current status of the pipeline run. + :paramtype status: str + :keyword imported_artifacts: The artifacts imported in the pipeline run. + :paramtype imported_artifacts: list[str] + :keyword progress: The current progress of the copy operation. + :paramtype progress: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProgressProperties + :keyword start_time: The time the pipeline run started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the pipeline run finished. + :paramtype finish_time: ~datetime.datetime + :keyword source: The source of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineSourceProperties + :keyword target: The target of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + :keyword trigger: The trigger that caused the pipeline run. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineTriggerDescriptor + :keyword pipeline_run_error_message: The detailed error message for the pipeline run in the + case of failure. + :paramtype pipeline_run_error_message: str + """ super(PipelineRunResponse, self).__init__(**kwargs) self.status = status self.imported_artifacts = imported_artifacts @@ -1326,12 +1675,12 @@ def __init__( class PipelineRunSourceProperties(msrest.serialization.Model): """PipelineRunSourceProperties. - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the source. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str + :ivar name: The name of the source. + :vartype name: str """ _attribute_map = { @@ -1346,6 +1695,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the source. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunSourceType + :keyword name: The name of the source. + :paramtype name: str + """ super(PipelineRunSourceProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1354,12 +1711,12 @@ def __init__( class PipelineRunTargetProperties(msrest.serialization.Model): """PipelineRunTargetProperties. - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the target. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str + :ivar name: The name of the target. + :vartype name: str """ _attribute_map = { @@ -1374,6 +1731,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the target. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunTargetType + :keyword name: The name of the target. + :paramtype name: str + """ super(PipelineRunTargetProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1382,8 +1747,8 @@ def __init__( class PipelineSourceTriggerDescriptor(msrest.serialization.Model): """PipelineSourceTriggerDescriptor. - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime + :ivar timestamp: The timestamp when the source update happened. + :vartype timestamp: ~datetime.datetime """ _attribute_map = { @@ -1396,6 +1761,10 @@ def __init__( timestamp: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword timestamp: The timestamp when the source update happened. + :paramtype timestamp: ~datetime.datetime + """ super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) self.timestamp = timestamp @@ -1405,9 +1774,9 @@ class PipelineSourceTriggerProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The current status of the source trigger. Possible values include: + :ivar status: Required. The current status of the source trigger. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TriggerStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TriggerStatus """ _validation = { @@ -1424,6 +1793,12 @@ def __init__( status: Union[str, "TriggerStatus"] = "Enabled", **kwargs ): + """ + :keyword status: Required. The current status of the source trigger. Possible values include: + "Enabled", "Disabled". Default value: "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TriggerStatus + """ super(PipelineSourceTriggerProperties, self).__init__(**kwargs) self.status = status @@ -1431,8 +1806,8 @@ def __init__( class PipelineTriggerDescriptor(msrest.serialization.Model): """PipelineTriggerDescriptor. - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: + :ivar source_trigger: The source trigger that caused the pipeline run. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceTriggerDescriptor """ @@ -1446,6 +1821,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerDescriptor"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger that caused the pipeline run. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceTriggerDescriptor + """ super(PipelineTriggerDescriptor, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1453,8 +1833,8 @@ def __init__( class PipelineTriggerProperties(msrest.serialization.Model): """PipelineTriggerProperties. - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: + :ivar source_trigger: The source trigger properties of the pipeline. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceTriggerProperties """ @@ -1468,6 +1848,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerProperties"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger properties of the pipeline. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineSourceTriggerProperties + """ super(PipelineTriggerProperties, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1475,13 +1860,13 @@ def __init__( class Policies(msrest.serialization.Model): """The policies for a container registry. - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: + :ivar quarantine_policy: The quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: + :ivar trust_policy: The content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicy + :ivar retention_policy: The retention policy for a container registry. + :vartype retention_policy: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RetentionPolicy """ @@ -1499,6 +1884,16 @@ def __init__( retention_policy: Optional["RetentionPolicy"] = None, **kwargs ): + """ + :keyword quarantine_policy: The quarantine policy for a container registry. + :paramtype quarantine_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.QuarantinePolicy + :keyword trust_policy: The content trust policy for a container registry. + :paramtype trust_policy: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicy + :keyword retention_policy: The retention policy for a container registry. + :paramtype retention_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RetentionPolicy + """ super(Policies, self).__init__(**kwargs) self.quarantine_policy = quarantine_policy self.trust_policy = trust_policy @@ -1508,8 +1903,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """The Private Endpoint resource. - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str + :ivar id: This is private endpoint resource created with Microsoft.Network resource provider. + :vartype id: str """ _attribute_map = { @@ -1522,6 +1917,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: This is private endpoint resource created with Microsoft.Network resource + provider. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -1539,12 +1939,12 @@ class PrivateEndpointConnection(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of private endpoint connection resource. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -1577,6 +1977,15 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -1586,13 +1995,13 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """The result of a request to list private endpoint connections for a container registry. - :param value: The list of private endpoint connections. Since this list may be incomplete, the + :ivar value: The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - :type value: + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint + :ivar next_link: The URI that can be used to request the next list of private endpoint connections. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1607,6 +2016,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private endpoint connections. Since this list may be incomplete, + the nextLink field should be used to request the next list of private endpoint connections. + :paramtype value: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] + :keyword next_link: The URI that can be used to request the next list of private endpoint + connections. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1619,16 +2037,16 @@ class PrivateLinkResource(msrest.serialization.Model): :ivar type: The resource type is private link resource. :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -1654,6 +2072,18 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword id: The resource ID. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.type = None self.id = id @@ -1666,11 +2096,12 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """The result of a request to list private link resources for a container registry. - :param value: The list of private link resources. Since this list may be incomplete, the + :ivar value: The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str + :vartype value: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResource] + :ivar next_link: The URI that can be used to request the next list of private link resources. + :vartype next_link: str """ _attribute_map = { @@ -1685,6 +2116,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :paramtype value: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResource] + :keyword next_link: The URI that can be used to request the next list of private link + resources. + :paramtype next_link: str + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1693,15 +2133,16 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :param status: The private link service connection status. Possible values include: "Approved", + :ivar status: The private link service connection status. Possible values include: "Approved", "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ConnectionStatus + :ivar description: The description for connection status. For example if connection is rejected + it can indicate reason for rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or + :vartype actions_required: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ActionsRequired """ @@ -1719,6 +2160,19 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: The private link service connection status. Possible values include: + "Approved", "Pending", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ConnectionStatus + :keyword description: The description for connection status. For example if connection is + rejected it can indicate reason for rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :paramtype actions_required: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ActionsRequired + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1728,8 +2182,8 @@ def __init__( class ProgressProperties(msrest.serialization.Model): """ProgressProperties. - :param percentage: The percentage complete of the copy operation. - :type percentage: str + :ivar percentage: The percentage complete of the copy operation. + :vartype percentage: str """ _attribute_map = { @@ -1742,6 +2196,10 @@ def __init__( percentage: Optional[str] = None, **kwargs ): + """ + :keyword percentage: The percentage complete of the copy operation. + :paramtype percentage: str + """ super(ProgressProperties, self).__init__(**kwargs) self.percentage = percentage @@ -1749,9 +2207,9 @@ def __init__( class QuarantinePolicy(msrest.serialization.Model): """The quarantine policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus """ _attribute_map = { @@ -1764,6 +2222,11 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + """ super(QuarantinePolicy, self).__init__(**kwargs) self.status = status @@ -1773,9 +2236,9 @@ class RegenerateCredentialParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName """ _validation = { @@ -1792,6 +2255,11 @@ def __init__( name: Union[str, "PasswordName"], **kwargs ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName + """ super(RegenerateCredentialParameters, self).__init__(**kwargs) self.name = name @@ -1809,11 +2277,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData """ @@ -1842,6 +2310,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1864,17 +2339,17 @@ class Registry(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties :ivar login_server: The URL that can be used to log into the container registry. :vartype login_server: str :ivar creation_date: The creation date of the container registry in ISO8601 format. @@ -1886,16 +2361,18 @@ class Registry(Resource): ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState :ivar status: The status of the container registry at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool :ivar data_endpoint_host_names: List of host names that will serve data when dataEndpointEnabled is true. :vartype data_endpoint_host_names: list[str] @@ -1903,13 +2380,13 @@ class Registry(Resource): registry. :vartype private_endpoint_connections: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleBypassOptions """ @@ -1968,6 +2445,38 @@ def __init__( network_rule_bypass_options: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleBypassOptions + """ super(Registry, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity @@ -1989,10 +2498,10 @@ def __init__( class RegistryListCredentialsResult(msrest.serialization.Model): """The response from the ListCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryPassword] """ @@ -2008,6 +2517,13 @@ def __init__( passwords: Optional[List["RegistryPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryPassword] + """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -2016,11 +2532,11 @@ def __init__( class RegistryListResult(msrest.serialization.Model): """The result of a request to list container registries. - :param value: The list of container registries. Since this list may be incomplete, the nextLink + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str """ _attribute_map = { @@ -2035,6 +2551,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ super(RegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2047,8 +2570,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the container registry. - :type name: str + :ivar name: Required. The name of the container registry. + :vartype name: str :ivar type: The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". @@ -2073,6 +2596,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ super(RegistryNameCheckRequest, self).__init__(**kwargs) self.name = name @@ -2080,13 +2607,13 @@ def __init__( class RegistryNameStatus(msrest.serialization.Model): """The result of a request to check the availability of a container registry name. - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str """ _attribute_map = { @@ -2103,6 +2630,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ super(RegistryNameStatus, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2112,10 +2648,10 @@ def __init__( class RegistryPassword(msrest.serialization.Model): """The login password for the container registry. - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName - :param value: The password value. - :type value: str + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName + :ivar value: The password value. + :vartype value: str """ _attribute_map = { @@ -2130,6 +2666,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ super(RegistryPassword, self).__init__(**kwargs) self.name = name self.value = value @@ -2138,29 +2680,31 @@ def __init__( class RegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a container registry. - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleBypassOptions """ @@ -2192,6 +2736,35 @@ def __init__( network_rule_bypass_options: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, **kwargs ): + """ + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleBypassOptions + """ super(RegistryUpdateParameters, self).__init__(**kwargs) self.identity = identity self.tags = tags @@ -2208,14 +2781,15 @@ def __init__( class RegistryUsage(msrest.serialization.Model): """The quota usage for a container registry. - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsageUnit + :ivar name: The name of the usage. + :vartype name: str + :ivar limit: The limit of the usage. + :vartype limit: long + :ivar current_value: The current value of the usage. + :vartype current_value: long + :ivar unit: The unit of measurement. Possible values include: "Count", "Bytes". + :vartype unit: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsageUnit """ _attribute_map = { @@ -2234,6 +2808,17 @@ def __init__( unit: Optional[Union[str, "RegistryUsageUnit"]] = None, **kwargs ): + """ + :keyword name: The name of the usage. + :paramtype name: str + :keyword limit: The limit of the usage. + :paramtype limit: long + :keyword current_value: The current value of the usage. + :paramtype current_value: long + :keyword unit: The unit of measurement. Possible values include: "Count", "Bytes". + :paramtype unit: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsageUnit + """ super(RegistryUsage, self).__init__(**kwargs) self.name = name self.limit = limit @@ -2244,8 +2829,8 @@ def __init__( class RegistryUsageListResult(msrest.serialization.Model): """The result of a request to get container registry quota usages. - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsage] + :ivar value: The list of container registry quota usages. + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsage] """ _attribute_map = { @@ -2258,6 +2843,10 @@ def __init__( value: Optional[List["RegistryUsage"]] = None, **kwargs ): + """ + :keyword value: The list of container registry quota usages. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsage] + """ super(RegistryUsageListResult, self).__init__(**kwargs) self.value = value @@ -2275,11 +2864,11 @@ class Replication(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData :ivar provisioning_state: The provisioning state of the replication at the time the operation @@ -2289,10 +2878,10 @@ class Replication(Resource): ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ProvisioningState :ivar status: The status of the replication at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool + :vartype region_endpoint_enabled: bool """ _validation = { @@ -2325,6 +2914,17 @@ def __init__( region_endpoint_enabled: Optional[bool] = True, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + """ super(Replication, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.status = None @@ -2334,11 +2934,11 @@ def __init__( class ReplicationListResult(msrest.serialization.Model): """The result of a request to list replications for a container registry. - :param value: The list of replications. Since this list may be incomplete, the nextLink field + :ivar value: The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + :ivar next_link: The URI that can be used to request the next list of replications. + :vartype next_link: str """ _attribute_map = { @@ -2353,6 +2953,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + :keyword next_link: The URI that can be used to request the next list of replications. + :paramtype next_link: str + """ super(ReplicationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2361,12 +2968,12 @@ def __init__( class ReplicationUpdateParameters(msrest.serialization.Model): """The parameters for updating a replication. - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar tags: A set of tags. The tags for the replication. + :vartype tags: dict[str, str] + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool + :vartype region_endpoint_enabled: bool """ _attribute_map = { @@ -2381,6 +2988,14 @@ def __init__( region_endpoint_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the replication. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + """ super(ReplicationUpdateParameters, self).__init__(**kwargs) self.tags = tags self.region_endpoint_enabled = region_endpoint_enabled @@ -2389,18 +3004,18 @@ def __init__( class Request(msrest.serialization.Model): """The request that generated the event. - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str """ _attribute_map = { @@ -2421,6 +3036,20 @@ def __init__( useragent: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the request that initiated the event. + :paramtype id: str + :keyword addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :paramtype addr: str + :keyword host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :paramtype host: str + :keyword method: The request method that generated the event. + :paramtype method: str + :keyword useragent: The user agent header of the request. + :paramtype useragent: str + """ super(Request, self).__init__(**kwargs) self.id = id self.addr = addr @@ -2434,13 +3063,13 @@ class RetentionPolicy(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int + :ivar days: The number of days to retain an untagged manifest after which it gets purged. + :vartype days: int :ivar last_updated_time: The timestamp when the policy was last updated. :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus """ _validation = { @@ -2460,6 +3089,13 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword days: The number of days to retain an untagged manifest after which it gets purged. + :paramtype days: int + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + """ super(RetentionPolicy, self).__init__(**kwargs) self.days = days self.last_updated_time = None @@ -2473,9 +3109,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name of the container registry. Required for registry creation. + :ivar name: Required. The SKU name of the container registry. Required for registry creation. Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SkuName :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", "Standard", "Premium". :vartype tier: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SkuTier @@ -2497,6 +3133,11 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Possible values include: "Classic", "Basic", "Standard", "Premium". + :paramtype name: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -2505,11 +3146,11 @@ def __init__( class Source(msrest.serialization.Model): """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :param addr: The IP or hostname and the port of the registry node that generated the event. + :ivar addr: The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str """ _attribute_map = { @@ -2524,6 +3165,13 @@ def __init__( instance_id: Optional[str] = None, **kwargs ): + """ + :keyword addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :paramtype addr: str + :keyword instance_id: The running instance of an application. Changes after each restart. + :paramtype instance_id: str + """ super(Source, self).__init__(**kwargs) self.addr = addr self.instance_id = instance_id @@ -2558,6 +3206,8 @@ def __init__( self, **kwargs ): + """ + """ super(Status, self).__init__(**kwargs) self.display_status = None self.message = None @@ -2567,22 +3217,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :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: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2605,6 +3255,24 @@ def __init__( 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". + :paramtype created_by_type: str or + ~azure.mgmt.containerregistry.v2019_12_01_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". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -2617,24 +3285,24 @@ def __init__( class Target(msrest.serialization.Model): """The target of the event. - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: long + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: long + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str """ _attribute_map = { @@ -2663,6 +3331,27 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword media_type: The MIME type of the referenced object. + :paramtype media_type: str + :keyword size: The number of bytes of the content. Same as Length field. + :paramtype size: long + :keyword digest: The digest of the content, as defined by the Registry V2 HTTP API + Specification. + :paramtype digest: str + :keyword length: The number of bytes of the content. Same as Size field. + :paramtype length: long + :keyword repository: The repository name. + :paramtype repository: str + :keyword url: The direct URL to the content. + :paramtype url: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword name: The name of the artifact. + :paramtype name: str + :keyword version: The version of the artifact. + :paramtype version: str + """ super(Target, self).__init__(**kwargs) self.media_type = media_type self.size = size @@ -2678,12 +3367,12 @@ def __init__( class TrustPolicy(msrest.serialization.Model): """The content trust policy for a container registry. - :param type: The type of trust policy. Possible values include: "Notary". Default value: + :ivar type: The type of trust policy. Possible values include: "Notary". Default value: "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values + :vartype type: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus """ _attribute_map = { @@ -2698,6 +3387,15 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicyType + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + """ super(TrustPolicy, self).__init__(**kwargs) self.type = type self.status = status @@ -2706,10 +3404,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -2724,6 +3422,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id @@ -2734,11 +3438,11 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar action: The action of virtual network rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str + :vartype virtual_network_resource_id: str """ _validation = { @@ -2757,6 +3461,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of virtual network rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Action + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.action = action self.virtual_network_resource_id = virtual_network_resource_id @@ -2775,22 +3486,22 @@ class Webhook(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] :ivar provisioning_state: The provisioning state of the webhook at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -2831,6 +3542,24 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] + """ super(Webhook, self).__init__(location=location, tags=tags, **kwargs) self.status = status self.scope = scope @@ -2843,24 +3572,24 @@ class WebhookCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the webhook. This cannot be changed after the resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] """ @@ -2890,6 +3619,28 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] + """ super(WebhookCreateParameters, self).__init__(**kwargs) self.tags = tags self.location = location @@ -2903,11 +3654,11 @@ def __init__( class WebhookListResult(msrest.serialization.Model): """The result of a request to list webhooks for a container registry. - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str + :ivar value: The list of webhooks. Since this list may be incomplete, the nextLink field should + be used to request the next list of webhooks. + :vartype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + :ivar next_link: The URI that can be used to request the next list of webhooks. + :vartype next_link: str """ _attribute_map = { @@ -2922,6 +3673,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :paramtype value: list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + :keyword next_link: The URI that can be used to request the next list of webhooks. + :paramtype next_link: str + """ super(WebhookListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2930,21 +3688,21 @@ def __init__( class WebhookUpdateParameters(msrest.serialization.Model): """The parameters for updating a webhook. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] """ @@ -2968,6 +3726,25 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] + """ super(WebhookUpdateParameters, self).__init__(**kwargs) self.tags = tags self.service_uri = service_uri diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_export_pipelines_operations.py index e53267f632db..95ac531e0221 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_export_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExportPipelinesOperations(object): """ExportPipelinesOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> "_models.ExportPipeline": """Gets the properties of the export pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> "_models.ExportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExportPipeline"] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ExportPipeline"]: """Creates an export pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an export pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ExportPipelineListResult"]: """Lists all export pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_import_pipelines_operations.py index 0838d7ce79bd..219ed89a0f92 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_import_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImportPipelinesOperations(object): """ImportPipelinesOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> "_models.ImportPipeline": """Gets the properties of the import pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> "_models.ImportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ImportPipeline"] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ImportPipeline"]: """Creates an import pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an import pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ImportPipelineListResult"]: """Lists all import pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py index 7fd9b08546ab..eabe47f0986f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Container Registry REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_pipeline_runs_operations.py index 5492a6466718..c9b4408cac0c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_pipeline_runs_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PipelineRunsOperations(object): """PipelineRunsOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> "_models.PipelineRun": """Gets the detailed information for a given pipeline run. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> "_models.PipelineRun": cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PipelineRun"] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> LROPoller["_models.PipelineRun"]: """Creates a pipeline run for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a pipeline run from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PipelineRunListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PipelineRunListResult"]: """Lists all the pipeline runs for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_private_endpoint_connections_operations.py index a87885d1afe7..db9091da0bf0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Update the state of specified private endpoint connection associated with the container registry. @@ -191,18 +326,24 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,28 +356,21 @@ def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,41 +382,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + 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', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -295,14 +421,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -314,15 +441,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -337,22 +466,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,15 +485,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all private endpoint connections in a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -381,8 +503,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -390,36 +514,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -437,6 +558,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py index 553177e03458..b6587f0d4def 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py @@ -5,25 +5,475 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_import_image_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -49,41 +499,32 @@ def __init__(self, client, config, serializer, deserializer): def _import_image_initial( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,14 +537,15 @@ def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace def begin_import_image( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> LROPoller[None]: """Copies an image to this container registry from the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -113,18 +555,22 @@ def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -136,24 +582,18 @@ def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -165,20 +605,22 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace def check_name_availability( self, - registry_name_check_request, # type: "_models.RegistryNameCheckRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryNameStatus" + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": """Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryNameStatus @@ -189,30 +631,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,15 +658,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": """Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -252,27 +686,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,47 +710,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry, 'Registry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -344,16 +759,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -365,15 +782,19 @@ def begin_create( :type registry: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,27 +806,21 @@ def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -417,39 +832,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -462,13 +869,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -478,15 +886,17 @@ def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -500,21 +910,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -526,47 +929,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -584,16 +977,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -602,18 +997,23 @@ def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -625,27 +1025,21 @@ def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,14 +1051,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry @@ -672,7 +1067,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -680,35 +1076,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -726,21 +1118,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -748,34 +1142,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,18 +1182,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -822,27 +1212,17 @@ def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -856,16 +1236,18 @@ def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace def regenerate_credential( self, - resource_group_name, # type: str - registry_name, # type: str - regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -875,7 +1257,8 @@ def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListCredentialsResult @@ -886,32 +1269,22 @@ def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -925,15 +1298,17 @@ def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace def list_usages( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryUsageListResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": """Gets the quota usages for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -951,27 +1326,17 @@ def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,15 +1350,17 @@ def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """Lists the private link resources for a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1002,8 +1369,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -1011,36 +1380,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1058,6 +1424,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py index 699fb1f47bb2..2799a399c328 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReplicationsOperations(object): """ReplicationsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": """Gets the properties of the specified replication. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Creates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,20 @@ def begin_create( :type replication: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a replication from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Updates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,24 @@ def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +632,21 @@ def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +658,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationListResult"]: """Lists all the replications for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -518,8 +676,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -527,36 +687,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +731,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py index 1f877e965b19..7978b54ccf32 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py @@ -5,25 +5,334 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_ping_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_callback_config_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_events_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-12-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebhooksOperations(object): """WebhooksOperations operations. @@ -47,14 +356,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": """Gets the properties of the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +383,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +408,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +459,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Creates a webhook for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +482,23 @@ def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +511,21 @@ def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +537,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +576,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a webhook from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +596,17 @@ def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +621,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +640,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +690,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Updates a webhook with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +713,23 @@ def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +742,21 @@ def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +768,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebhookListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.WebhookListResult"]: """Lists all the webhooks for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +787,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -527,36 +796,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,19 +840,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace def ping( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventInfo" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": """Triggers a ping event to be sent to the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +873,18 @@ def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +898,18 @@ def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace def get_callback_config( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CallbackConfig" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": """Gets the configuration of service URI and custom headers for the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -670,28 +929,18 @@ def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -705,16 +954,18 @@ def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventListResult"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> Iterable["_models.EventListResult"]: """Lists recent events for the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -726,7 +977,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -734,37 +986,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -782,6 +1032,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_configuration.py index 984fec7a95b7..af127fad4618 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_container_registry_management_client.py index 162be2971497..f72b094590d5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_container_registry_management_client.py @@ -6,124 +6,117 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations, ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, ScopeMapsOperations, TokensOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ConnectedRegistriesOperations -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import WebhooksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar connected_registries: ConnectedRegistriesOperations operations - :vartype connected_registries: azure.mgmt.containerregistry.v2020_11_01_preview.operations.ConnectedRegistriesOperations + :vartype connected_registries: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.ConnectedRegistriesOperations :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2020_11_01_preview.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2020_11_01_preview.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2020_11_01_preview.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2020_11_01_preview.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2020_11_01_preview.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2020_11_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2020_11_01_preview.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.ReplicationsOperations :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2020_11_01_preview.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations :vartype tokens: azure.mgmt.containerregistry.v2020_11_01_preview.operations.TokensOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2020_11_01_preview.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2020_11_01_preview.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.connected_registries = ConnectedRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.connected_registries = ConnectedRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_metadata.json index 3b7e41197db6..d1a06bf3fb92 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "connected_registries": "ConnectedRegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_configuration.py index 565c09a912c6..9db09099e41f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_container_registry_management_client.py index f710013e8fda..116739af6a2f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_container_registry_management_client.py @@ -6,120 +6,118 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations, ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, ScopeMapsOperations, TokensOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ConnectedRegistriesOperations -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import WebhooksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar connected_registries: ConnectedRegistriesOperations operations - :vartype connected_registries: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ConnectedRegistriesOperations + :vartype connected_registries: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ConnectedRegistriesOperations :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ReplicationsOperations :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations - :vartype tokens: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.TokensOperations + :vartype tokens: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.TokensOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2020_11_01_preview.aio.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.connected_registries = ConnectedRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + - self.connected_registries = ConnectedRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_connected_registries_operations.py index 06e2987119c0..3c0da27d1ef4 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_connected_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._connected_registries_operations import build_create_request_initial, build_deactivate_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,34 +75,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -105,8 +101,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -120,40 +118,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -165,8 +152,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -185,18 +175,24 @@ async def begin_create( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,28 +205,21 @@ async def begin_create( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_create_parameters=connected_registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -242,6 +231,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore async def _delete_initial( @@ -256,41 +246,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -309,15 +290,17 @@ async def begin_delete( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +315,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,6 +334,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore async def _update_initial( @@ -374,40 +350,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -419,8 +384,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,18 +407,24 @@ async def begin_update( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryUpdateParameters + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,28 +437,21 @@ async def begin_update( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_update_parameters=connected_registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -496,8 +463,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -517,8 +486,10 @@ def list( connectedRegistry parent), mode, and connectionState. The supported operator is eq. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryListResult] + :return: An iterator like instance of either ConnectedRegistryListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] @@ -526,38 +497,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + deserialized = self._deserialize("ConnectedRegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,12 +538,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -593,41 +562,32 @@ async def _deactivate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + @distributed_trace_async async def begin_deactivate( self, resource_group_name: str, @@ -646,15 +606,17 @@ async def begin_deactivate( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -669,22 +631,14 @@ async def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -696,4 +650,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_export_pipelines_operations.py index d985b8cbf9fb..98c2ec0a1169 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_export_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._export_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_import_pipelines_operations.py index 052e62c75dea..1152e386480c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_import_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._import_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_operations.py index 78966cbe2454..f40a9fd514f9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_pipeline_runs_operations.py index bfcacbd8eaa8..c00b50a51fbd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_pipeline_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._pipeline_runs_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_private_endpoint_connections_operations.py index 4eada6f9e8d2..ab37e450a168 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -184,18 +175,24 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,28 +205,21 @@ async def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,6 +231,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -255,26 +246,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,6 +270,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -305,15 +290,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -328,22 +315,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,8 +334,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -371,8 +352,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -380,36 +363,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -427,6 +407,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_registries_operations.py index 87c44a005c70..32ebd16e0665 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_generate_credentials_request_initial, build_get_request, build_import_image_request_initial, build_list_by_resource_group_request, build_list_credentials_request, build_list_private_link_resources_request, build_list_request, build_list_usages_request, build_regenerate_credential_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,30 +60,22 @@ async def _import_image_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImportImageParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -91,6 +88,8 @@ async def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace_async async def begin_import_image( self, resource_group_name: str, @@ -107,18 +106,22 @@ async def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -130,24 +133,18 @@ async def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -159,8 +156,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace_async async def check_name_availability( self, registry_name_check_request: "_models.RegistryNameCheckRequest", @@ -171,7 +170,8 @@ async def check_name_availability( :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryNameStatus @@ -182,30 +182,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,8 +209,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -244,27 +237,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,8 +261,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -292,32 +277,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -335,8 +310,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -355,15 +333,20 @@ async def begin_create( :type registry: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -375,27 +358,21 @@ async def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,6 +384,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _delete_initial( @@ -420,25 +398,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -451,6 +421,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -466,15 +438,17 @@ async def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -488,21 +462,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,6 +481,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _update_initial( @@ -528,32 +496,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -571,8 +529,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -588,18 +549,24 @@ async def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -611,27 +578,21 @@ async def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -643,8 +604,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -657,7 +620,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -665,35 +629,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -711,11 +671,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -724,7 +686,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -732,34 +695,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -777,11 +735,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace_async async def list_credentials( self, resource_group_name: str, @@ -805,27 +765,17 @@ async def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,8 +789,11 @@ async def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace_async async def regenerate_credential( self, resource_group_name: str, @@ -857,7 +810,8 @@ async def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListCredentialsResult @@ -868,32 +822,22 @@ async def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -907,8 +851,11 @@ async def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace_async async def list_usages( self, resource_group_name: str, @@ -932,27 +879,17 @@ async def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -966,8 +903,11 @@ async def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, resource_group_name: str, @@ -982,8 +922,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -991,36 +933,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1038,6 +977,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1055,32 +995,22 @@ async def _generate_credentials_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') + + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,8 +1026,11 @@ async def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace_async async def begin_generate_credentials( self, resource_group_name: str, @@ -1113,18 +1046,24 @@ async def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1136,27 +1075,21 @@ async def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1168,4 +1101,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_replications_operations.py index a863dbcd02bb..998ab1555c54 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_replications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._replications_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,20 @@ async def begin_create( :type replication: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +203,21 @@ async def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +229,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _delete_initial( @@ -254,26 +244,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +268,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +288,17 @@ async def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +313,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +332,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _update_initial( @@ -369,33 +348,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +382,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +405,24 @@ async def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +435,21 @@ async def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -506,8 +479,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_scope_maps_operations.py index d9293223e0c2..4411f5e58678 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_scope_maps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._scope_maps_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_tokens_operations.py index eb0121565d9c..1430a42c1133 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_tokens_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tokens_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_create_parameters, 'Token') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,19 @@ async def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +202,21 @@ async def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +228,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _delete_initial( @@ -254,26 +243,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +267,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +287,17 @@ async def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +312,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +331,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _update_initial( @@ -369,33 +347,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +381,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +404,23 @@ async def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +433,21 @@ async def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +459,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +478,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -515,36 +487,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +531,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_webhooks_operations.py index 6f72f8ec3ce7..6ddc72905dda 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/operations/_webhooks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._webhooks_operations import build_create_request_initial, build_delete_request_initial, build_get_callback_config_request, build_get_request, build_list_events_request, build_list_request, build_ping_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace_async async def ping( self, resource_group_name: str, @@ -593,28 +567,18 @@ async def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +592,11 @@ async def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace_async async def get_callback_config( self, resource_group_name: str, @@ -656,28 +623,18 @@ async def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -691,8 +648,11 @@ async def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, resource_group_name: str, @@ -711,7 +671,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -719,37 +680,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -767,6 +726,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/__init__.py index 77b6ebfdcbfa..e584b3f8515c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/__init__.py @@ -6,214 +6,110 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActivationProperties - from ._models_py3 import ActiveDirectoryObject - from ._models_py3 import Actor - from ._models_py3 import CallbackConfig - from ._models_py3 import ConnectedRegistry - from ._models_py3 import ConnectedRegistryListResult - from ._models_py3 import ConnectedRegistryUpdateParameters - from ._models_py3 import EncryptionProperty - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import Event - from ._models_py3 import EventContent - from ._models_py3 import EventInfo - from ._models_py3 import EventListResult - from ._models_py3 import EventRequestMessage - from ._models_py3 import EventResponseMessage - from ._models_py3 import ExportPipeline - from ._models_py3 import ExportPipelineListResult - from ._models_py3 import ExportPipelineTargetProperties - from ._models_py3 import GenerateCredentialsParameters - from ._models_py3 import GenerateCredentialsResult - from ._models_py3 import IPRule - from ._models_py3 import IdentityProperties - from ._models_py3 import ImportImageParameters - from ._models_py3 import ImportPipeline - from ._models_py3 import ImportPipelineListResult - from ._models_py3 import ImportPipelineSourceProperties - from ._models_py3 import ImportSource - from ._models_py3 import ImportSourceCredentials - from ._models_py3 import InnerErrorDescription - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LoggingProperties - from ._models_py3 import LoginServerProperties - from ._models_py3 import NetworkRuleSet - from ._models_py3 import OperationDefinition - from ._models_py3 import OperationDisplayDefinition - from ._models_py3 import OperationListResult - from ._models_py3 import OperationLogSpecificationDefinition - from ._models_py3 import OperationMetricSpecificationDefinition - from ._models_py3 import OperationServiceSpecificationDefinition - from ._models_py3 import ParentProperties - from ._models_py3 import PipelineRun - from ._models_py3 import PipelineRunListResult - from ._models_py3 import PipelineRunRequest - from ._models_py3 import PipelineRunResponse - from ._models_py3 import PipelineRunSourceProperties - from ._models_py3 import PipelineRunTargetProperties - from ._models_py3 import PipelineSourceTriggerDescriptor - from ._models_py3 import PipelineSourceTriggerProperties - from ._models_py3 import PipelineTriggerDescriptor - from ._models_py3 import PipelineTriggerProperties - from ._models_py3 import Policies - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProgressProperties - from ._models_py3 import ProxyResource - from ._models_py3 import QuarantinePolicy - from ._models_py3 import RegenerateCredentialParameters - from ._models_py3 import Registry - from ._models_py3 import RegistryListCredentialsResult - from ._models_py3 import RegistryListResult - from ._models_py3 import RegistryNameCheckRequest - from ._models_py3 import RegistryNameStatus - from ._models_py3 import RegistryPassword - from ._models_py3 import RegistryUpdateParameters - from ._models_py3 import RegistryUsage - from ._models_py3 import RegistryUsageListResult - from ._models_py3 import Replication - from ._models_py3 import ReplicationListResult - from ._models_py3 import ReplicationUpdateParameters - from ._models_py3 import Request - from ._models_py3 import Resource - from ._models_py3 import RetentionPolicy - from ._models_py3 import ScopeMap - from ._models_py3 import ScopeMapListResult - from ._models_py3 import ScopeMapUpdateParameters - from ._models_py3 import Sku - from ._models_py3 import Source - from ._models_py3 import Status - from ._models_py3 import StatusDetailProperties - from ._models_py3 import SyncProperties - from ._models_py3 import SyncUpdateProperties - from ._models_py3 import SystemData - from ._models_py3 import Target - from ._models_py3 import TlsCertificateProperties - from ._models_py3 import TlsProperties - from ._models_py3 import Token - from ._models_py3 import TokenCertificate - from ._models_py3 import TokenCredentialsProperties - from ._models_py3 import TokenListResult - from ._models_py3 import TokenPassword - from ._models_py3 import TokenUpdateParameters - from ._models_py3 import TrustPolicy - from ._models_py3 import UserIdentityProperties - from ._models_py3 import VirtualNetworkRule - from ._models_py3 import Webhook - from ._models_py3 import WebhookCreateParameters - from ._models_py3 import WebhookListResult - from ._models_py3 import WebhookUpdateParameters -except (SyntaxError, ImportError): - from ._models import ActivationProperties # type: ignore - from ._models import ActiveDirectoryObject # type: ignore - from ._models import Actor # type: ignore - from ._models import CallbackConfig # type: ignore - from ._models import ConnectedRegistry # type: ignore - from ._models import ConnectedRegistryListResult # type: ignore - from ._models import ConnectedRegistryUpdateParameters # type: ignore - from ._models import EncryptionProperty # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import Event # type: ignore - from ._models import EventContent # type: ignore - from ._models import EventInfo # type: ignore - from ._models import EventListResult # type: ignore - from ._models import EventRequestMessage # type: ignore - from ._models import EventResponseMessage # type: ignore - from ._models import ExportPipeline # type: ignore - from ._models import ExportPipelineListResult # type: ignore - from ._models import ExportPipelineTargetProperties # type: ignore - from ._models import GenerateCredentialsParameters # type: ignore - from ._models import GenerateCredentialsResult # type: ignore - from ._models import IPRule # type: ignore - from ._models import IdentityProperties # type: ignore - from ._models import ImportImageParameters # type: ignore - from ._models import ImportPipeline # type: ignore - from ._models import ImportPipelineListResult # type: ignore - from ._models import ImportPipelineSourceProperties # type: ignore - from ._models import ImportSource # type: ignore - from ._models import ImportSourceCredentials # type: ignore - from ._models import InnerErrorDescription # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LoggingProperties # type: ignore - from ._models import LoginServerProperties # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import OperationDefinition # type: ignore - from ._models import OperationDisplayDefinition # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationLogSpecificationDefinition # type: ignore - from ._models import OperationMetricSpecificationDefinition # type: ignore - from ._models import OperationServiceSpecificationDefinition # type: ignore - from ._models import ParentProperties # type: ignore - from ._models import PipelineRun # type: ignore - from ._models import PipelineRunListResult # type: ignore - from ._models import PipelineRunRequest # type: ignore - from ._models import PipelineRunResponse # type: ignore - from ._models import PipelineRunSourceProperties # type: ignore - from ._models import PipelineRunTargetProperties # type: ignore - from ._models import PipelineSourceTriggerDescriptor # type: ignore - from ._models import PipelineSourceTriggerProperties # type: ignore - from ._models import PipelineTriggerDescriptor # type: ignore - from ._models import PipelineTriggerProperties # type: ignore - from ._models import Policies # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProgressProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QuarantinePolicy # type: ignore - from ._models import RegenerateCredentialParameters # type: ignore - from ._models import Registry # type: ignore - from ._models import RegistryListCredentialsResult # type: ignore - from ._models import RegistryListResult # type: ignore - from ._models import RegistryNameCheckRequest # type: ignore - from ._models import RegistryNameStatus # type: ignore - from ._models import RegistryPassword # type: ignore - from ._models import RegistryUpdateParameters # type: ignore - from ._models import RegistryUsage # type: ignore - from ._models import RegistryUsageListResult # type: ignore - from ._models import Replication # type: ignore - from ._models import ReplicationListResult # type: ignore - from ._models import ReplicationUpdateParameters # type: ignore - from ._models import Request # type: ignore - from ._models import Resource # type: ignore - from ._models import RetentionPolicy # type: ignore - from ._models import ScopeMap # type: ignore - from ._models import ScopeMapListResult # type: ignore - from ._models import ScopeMapUpdateParameters # type: ignore - from ._models import Sku # type: ignore - from ._models import Source # type: ignore - from ._models import Status # type: ignore - from ._models import StatusDetailProperties # type: ignore - from ._models import SyncProperties # type: ignore - from ._models import SyncUpdateProperties # type: ignore - from ._models import SystemData # type: ignore - from ._models import Target # type: ignore - from ._models import TlsCertificateProperties # type: ignore - from ._models import TlsProperties # type: ignore - from ._models import Token # type: ignore - from ._models import TokenCertificate # type: ignore - from ._models import TokenCredentialsProperties # type: ignore - from ._models import TokenListResult # type: ignore - from ._models import TokenPassword # type: ignore - from ._models import TokenUpdateParameters # type: ignore - from ._models import TrustPolicy # type: ignore - from ._models import UserIdentityProperties # type: ignore - from ._models import VirtualNetworkRule # type: ignore - from ._models import Webhook # type: ignore - from ._models import WebhookCreateParameters # type: ignore - from ._models import WebhookListResult # type: ignore - from ._models import WebhookUpdateParameters # type: ignore +from ._models_py3 import ActivationProperties +from ._models_py3 import ActiveDirectoryObject +from ._models_py3 import Actor +from ._models_py3 import CallbackConfig +from ._models_py3 import ConnectedRegistry +from ._models_py3 import ConnectedRegistryListResult +from ._models_py3 import ConnectedRegistryUpdateParameters +from ._models_py3 import EncryptionProperty +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import Event +from ._models_py3 import EventContent +from ._models_py3 import EventInfo +from ._models_py3 import EventListResult +from ._models_py3 import EventRequestMessage +from ._models_py3 import EventResponseMessage +from ._models_py3 import ExportPipeline +from ._models_py3 import ExportPipelineListResult +from ._models_py3 import ExportPipelineTargetProperties +from ._models_py3 import GenerateCredentialsParameters +from ._models_py3 import GenerateCredentialsResult +from ._models_py3 import IPRule +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportImageParameters +from ._models_py3 import ImportPipeline +from ._models_py3 import ImportPipelineListResult +from ._models_py3 import ImportPipelineSourceProperties +from ._models_py3 import ImportSource +from ._models_py3 import ImportSourceCredentials +from ._models_py3 import InnerErrorDescription +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LoggingProperties +from ._models_py3 import LoginServerProperties +from ._models_py3 import NetworkRuleSet +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import OperationLogSpecificationDefinition +from ._models_py3 import OperationMetricSpecificationDefinition +from ._models_py3 import OperationServiceSpecificationDefinition +from ._models_py3 import ParentProperties +from ._models_py3 import PipelineRun +from ._models_py3 import PipelineRunListResult +from ._models_py3 import PipelineRunRequest +from ._models_py3 import PipelineRunResponse +from ._models_py3 import PipelineRunSourceProperties +from ._models_py3 import PipelineRunTargetProperties +from ._models_py3 import PipelineSourceTriggerDescriptor +from ._models_py3 import PipelineSourceTriggerProperties +from ._models_py3 import PipelineTriggerDescriptor +from ._models_py3 import PipelineTriggerProperties +from ._models_py3 import Policies +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProgressProperties +from ._models_py3 import ProxyResource +from ._models_py3 import QuarantinePolicy +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import RegistryUsage +from ._models_py3 import RegistryUsageListResult +from ._models_py3 import Replication +from ._models_py3 import ReplicationListResult +from ._models_py3 import ReplicationUpdateParameters +from ._models_py3 import Request +from ._models_py3 import Resource +from ._models_py3 import RetentionPolicy +from ._models_py3 import ScopeMap +from ._models_py3 import ScopeMapListResult +from ._models_py3 import ScopeMapUpdateParameters +from ._models_py3 import Sku +from ._models_py3 import Source +from ._models_py3 import Status +from ._models_py3 import StatusDetailProperties +from ._models_py3 import SyncProperties +from ._models_py3 import SyncUpdateProperties +from ._models_py3 import SystemData +from ._models_py3 import Target +from ._models_py3 import TlsCertificateProperties +from ._models_py3 import TlsProperties +from ._models_py3 import Token +from ._models_py3 import TokenCertificate +from ._models_py3 import TokenCredentialsProperties +from ._models_py3 import TokenListResult +from ._models_py3 import TokenPassword +from ._models_py3 import TokenUpdateParameters +from ._models_py3 import TrustPolicy +from ._models_py3 import UserIdentityProperties +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import Webhook +from ._models_py3 import WebhookCreateParameters +from ._models_py3 import WebhookListResult +from ._models_py3 import WebhookUpdateParameters + from ._container_registry_management_client_enums import ( Action, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_container_registry_management_client_enums.py index c03b3a9db3ea..fc442419f023 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_container_registry_management_client_enums.py @@ -6,67 +6,52 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Action(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action of virtual network rule. """ ALLOW = "Allow" -class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" RECREATE = "Recreate" -class ActivationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActivationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The activation status of the connected registry. """ ACTIVE = "Active" INACTIVE = "Inactive" -class AuditLogStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuditLogStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether audit logs are enabled on the connected registry. """ ENABLED = "Enabled" DISABLED = "Disabled" -class CertificateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of certificate location. """ LOCAL_DIRECTORY = "LocalDirectory" -class ConnectedRegistryMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectedRegistryMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The mode of the connected registry resource that indicates the permissions of the registry. """ REGISTRY = "Registry" MIRROR = "Mirror" -class ConnectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current connection state of the connected registry. """ @@ -75,7 +60,7 @@ class ConnectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYNCING = "Syncing" UNHEALTHY = "Unhealthy" -class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private link service connection status. """ @@ -84,7 +69,7 @@ class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -93,21 +78,21 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class EncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether or not the encryption is enabled for container registry. """ ENABLED = "enabled" DISABLED = "disabled" -class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImportMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. """ @@ -115,7 +100,7 @@ class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NO_FORCE = "NoForce" FORCE = "Force" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -124,7 +109,7 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The verbosity of logs persisted on the connected registry. """ @@ -134,53 +119,53 @@ class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" NONE = "None" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to allow trusted Azure services to access a network restricted registry. """ AZURE_SERVICES = "AzureServices" NONE = "None" -class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name. """ PASSWORD = "password" PASSWORD2 = "password2" -class PipelineOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OVERWRITE_TAGS = "OverwriteTags" OVERWRITE_BLOBS = "OverwriteBlobs" DELETE_SOURCE_BLOB_ON_SUCCESS = "DeleteSourceBlobOnSuccess" CONTINUE_ON_ERRORS = "ContinueOnErrors" -class PipelineRunSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the source. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineRunTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunTargetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the target. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source for the import pipeline. """ AZURE_STORAGE_BLOB_CONTAINER = "AzureStorageBlobContainer" -class PolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the resource. """ @@ -191,21 +176,21 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not public network access is allowed for the container registry. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RegistryUsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegistryUsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement. """ COUNT = "Count" BYTES = "Bytes" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -214,7 +199,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name of the container registry. Required for registry creation. """ @@ -223,7 +208,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier based on the SKU name. """ @@ -232,46 +217,46 @@ class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TlsStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TlsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether HTTPS is enabled for the login server. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TokenCertificateName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenCertificateName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CERTIFICATE1 = "certificate1" CERTIFICATE2 = "certificate2" -class TokenPasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenPasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name "password1" or "password2" """ PASSWORD1 = "password1" PASSWORD2 = "password2" -class TokenStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the token example enabled or disabled. """ ENABLED = "enabled" DISABLED = "disabled" -class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the source trigger. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TrustPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrustPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of trust policy. """ NOTARY = "Notary" -class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PUSH = "push" DELETE = "delete" @@ -279,14 +264,14 @@ class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CHART_PUSH = "chart_push" CHART_DELETE = "chart_delete" -class WebhookStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the webhook at the time the operation was called. """ ENABLED = "enabled" DISABLED = "disabled" -class ZoneRedundancy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ZoneRedundancy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not zone redundancy is enabled for this container registry """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py deleted file mode 100644 index 3e1b98272095..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py +++ /dev/null @@ -1,3635 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ActivationProperties(msrest.serialization.Model): - """The activation properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The activation status of the connected registry. Possible values include: - "Active", "Inactive". - :vartype status: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ActivationStatus - """ - - _validation = { - 'status': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActivationProperties, self).__init__(**kwargs) - self.status = None - - -class ActiveDirectoryObject(msrest.serialization.Model): - """The Active Directory Object that will be used for authenticating the token of a container registry. - - :param object_id: The user/group/application object ID for Active Directory Object that will be - used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that - will be used for authenticating the token of a container registry. - :type tenant_id: str - """ - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryObject, self).__init__(**kwargs) - self.object_id = kwargs.get('object_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - - -class Actor(msrest.serialization.Model): - """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - - :param name: The subject or username associated with the request context that generated the - event. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Actor, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class CallbackConfig(msrest.serialization.Model): - """The configuration of service URI and custom headers for the webhook. - - All required parameters must be populated in order to send to Azure. - - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - """ - - _validation = { - 'service_uri': {'required': True}, - } - - _attribute_map = { - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(CallbackConfig, self).__init__(**kwargs) - self.service_uri = kwargs['service_uri'] - self.custom_headers = kwargs.get('custom_headers', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ConnectedRegistry(ProxyResource): - """An object that represents a connected registry for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param mode: The mode of the connected registry resource that indicates the permissions of the - registry. Possible values include: "Registry", "Mirror". - :type mode: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryMode - :ivar version: The current version of ACR runtime on the connected registry. - :vartype version: str - :ivar connection_state: The current connection state of the connected registry. Possible values - include: "Online", "Offline", "Syncing", "Unhealthy". - :vartype connection_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectionState - :ivar last_activity_time: The last activity time of the connected registry. - :vartype last_activity_time: ~datetime.datetime - :ivar activation: The activation properties of the connected registry. - :vartype activation: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ActivationProperties - :param parent: The parent of the connected registry. - :type parent: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ParentProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :type client_token_ids: list[str] - :param login_server: The login server properties of the connected registry. - :type login_server: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoginServerProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties - :ivar status_details: The list of current statuses of the connected registry. - :vartype status_details: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.StatusDetailProperties] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'connection_state': {'readonly': True}, - 'last_activity_time': {'readonly': True}, - 'activation': {'readonly': True}, - 'status_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'connection_state': {'key': 'properties.connectionState', 'type': 'str'}, - 'last_activity_time': {'key': 'properties.lastActivityTime', 'type': 'iso-8601'}, - 'activation': {'key': 'properties.activation', 'type': 'ActivationProperties'}, - 'parent': {'key': 'properties.parent', 'type': 'ParentProperties'}, - 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'LoginServerProperties'}, - 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, - 'status_details': {'key': 'properties.statusDetails', 'type': '[StatusDetailProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistry, self).__init__(**kwargs) - self.provisioning_state = None - self.mode = kwargs.get('mode', None) - self.version = None - self.connection_state = None - self.last_activity_time = None - self.activation = None - self.parent = kwargs.get('parent', None) - self.client_token_ids = kwargs.get('client_token_ids', None) - self.login_server = kwargs.get('login_server', None) - self.logging = kwargs.get('logging', None) - self.status_details = None - - -class ConnectedRegistryListResult(msrest.serialization.Model): - """The result of a request to list connected registries for a container registry. - - :param value: The list of connected registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of connected registries. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] - :param next_link: The URI that can be used to request the next list of connected registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ConnectedRegistry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ConnectedRegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a connected registry. - - :param sync_properties: The sync properties of the connected registry with its parent. - :type sync_properties: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SyncUpdateProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :type client_token_ids: list[str] - """ - - _attribute_map = { - 'sync_properties': {'key': 'properties.syncProperties', 'type': 'SyncUpdateProperties'}, - 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, - 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) - self.sync_properties = kwargs.get('sync_properties', None) - self.logging = kwargs.get('logging', None) - self.client_token_ids = kwargs.get('client_token_ids', None) - - -class EncryptionProperty(msrest.serialization.Model): - """EncryptionProperty. - - :param status: Indicates whether or not the encryption is enabled for container registry. - Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.KeyVaultProperties - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProperty, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this - contract. - :type details: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.InnerErrorDescription - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class EventInfo(msrest.serialization.Model): - """The basic information of an event. - - :param id: The event ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventInfo, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Event(EventInfo): - """The event for a webhook. - - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventResponseMessage - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, - 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.event_request_message = kwargs.get('event_request_message', None) - self.event_response_message = kwargs.get('event_response_message', None) - - -class EventContent(msrest.serialization.Model): - """The content of the event request message. - - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the - authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor - initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Source - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'action': {'key': 'action', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'Target'}, - 'request': {'key': 'request', 'type': 'Request'}, - 'actor': {'key': 'actor', 'type': 'Actor'}, - 'source': {'key': 'source', 'type': 'Source'}, - } - - def __init__( - self, - **kwargs - ): - super(EventContent, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.action = kwargs.get('action', None) - self.target = kwargs.get('target', None) - self.request = kwargs.get('request', None) - self.actor = kwargs.get('actor', None) - self.source = kwargs.get('source', None) - - -class EventListResult(msrest.serialization.Model): - """The result of a request to list events for a webhook. - - :param value: The list of events. Since this list may be incomplete, the nextLink field should - be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventRequestMessage(msrest.serialization.Model): - """The event request message sent to the service URI. - - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'EventContent'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'method': {'key': 'method', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventRequestMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.method = kwargs.get('method', None) - self.request_uri = kwargs.get('request_uri', None) - self.version = kwargs.get('version', None) - - -class EventResponseMessage(msrest.serialization.Model): - """The event response message received from the service URI. - - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventResponseMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.reason_phrase = kwargs.get('reason_phrase', None) - self.status_code = kwargs.get('status_code', None) - self.version = kwargs.get('version', None) - - -class ExportPipeline(ProxyResource): - """An object that represents an export pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'target': {'key': 'properties.target', 'type': 'ExportPipelineTargetProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.target = kwargs.get('target', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ExportPipelineListResult(msrest.serialization.Model): - """The result of a request to list export pipelines for a container registry. - - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExportPipelineTargetProperties(msrest.serialization.Model): - """The properties of the export pipeline target. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class GenerateCredentialsParameters(msrest.serialization.Model): - """The parameters used to generate credentials for a specified token or user of a container registry. - - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become - invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or - password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName - """ - - _attribute_map = { - 'token_id': {'key': 'tokenId', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsParameters, self).__init__(**kwargs) - self.token_id = kwargs.get('token_id', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - - -class GenerateCredentialsResult(msrest.serialization.Model): - """The response from the GenerateCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class IdentityProperties(msrest.serialization.Model): - """Managed identity for the resource. - - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", "None". - :type type: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity - dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.UserIdentityProperties] - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImportImageParameters(msrest.serialization.Model): - """ImportImageParameters. - - All required parameters must be populated in order to send to Azure. - - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will - be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only - copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any - existing target tags will fail the operation before any copying begins. Possible values - include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportMode - """ - - _validation = { - 'source': {'required': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'ImportSource'}, - 'target_tags': {'key': 'targetTags', 'type': '[str]'}, - 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportImageParameters, self).__init__(**kwargs) - self.source = kwargs['source'] - self.target_tags = kwargs.get('target_tags', None) - self.untagged_target_repositories = kwargs.get('untagged_target_repositories', None) - self.mode = kwargs.get('mode', "NoForce") - - -class ImportPipeline(ProxyResource): - """An object that represents an import pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'source': {'key': 'properties.source', 'type': 'ImportPipelineSourceProperties'}, - 'trigger': {'key': 'properties.trigger', 'type': 'PipelineTriggerProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.source = kwargs.get('source', None) - self.trigger = kwargs.get('trigger', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ImportPipelineListResult(msrest.serialization.Model): - """The result of a request to list import pipelines for a container registry. - - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ImportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ImportPipelineSourceProperties(msrest.serialization.Model): - """The properties of the import pipeline source. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of source for the import pipeline. Possible values include: - "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlobContainer") - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class ImportSource(msrest.serialization.Model): - """ImportSource. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str - """ - - _validation = { - 'source_image': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'registry_uri': {'key': 'registryUri', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, - 'source_image': {'key': 'sourceImage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSource, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.registry_uri = kwargs.get('registry_uri', None) - self.credentials = kwargs.get('credentials', None) - self.source_image = kwargs['source_image'] - - -class ImportSourceCredentials(msrest.serialization.Model): - """ImportSourceCredentials. - - All required parameters must be populated in order to send to Azure. - - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str - """ - - _validation = { - 'password': {'required': True}, - } - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSourceCredentials, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs['password'] - - -class InnerErrorDescription(msrest.serialization.Model): - """inner error. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InnerErrorDescription, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.ip_address_or_range = kwargs['ip_address_or_range'] - - -class KeyVaultProperties(msrest.serialization.Model): - """KeyVaultProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str - :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of - the key that is actually used for encryption. - :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str - :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. - :vartype key_rotation_enabled: bool - :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'versioned_key_identifier': {'readonly': True}, - 'key_rotation_enabled': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'versioned_key_identifier': {'key': 'versionedKeyIdentifier', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'str'}, - 'key_rotation_enabled': {'key': 'keyRotationEnabled', 'type': 'bool'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_identifier = kwargs.get('key_identifier', None) - self.versioned_key_identifier = None - self.identity = kwargs.get('identity', None) - self.key_rotation_enabled = None - self.last_key_rotation_timestamp = None - - -class LoggingProperties(msrest.serialization.Model): - """The logging properties of the connected registry. - - :param log_level: The verbosity of logs persisted on the connected registry. Possible values - include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". - :type log_level: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LogLevel - :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. - Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type audit_log_status: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.AuditLogStatus - """ - - _attribute_map = { - 'log_level': {'key': 'logLevel', 'type': 'str'}, - 'audit_log_status': {'key': 'auditLogStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoggingProperties, self).__init__(**kwargs) - self.log_level = kwargs.get('log_level', "Information") - self.audit_log_status = kwargs.get('audit_log_status', "Disabled") - - -class LoginServerProperties(msrest.serialization.Model): - """The login server properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar host: The host of the connected registry. Can be FQDN or IP. - :vartype host: str - :ivar tls: The TLS properties of the connected registry login server. - :vartype tls: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TlsProperties - """ - - _validation = { - 'host': {'readonly': True}, - 'tls': {'readonly': True}, - } - - _attribute_map = { - 'host': {'key': 'host', 'type': 'str'}, - 'tls': {'key': 'tls', 'type': 'TlsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(LoginServerProperties, self).__init__(**kwargs) - self.host = None - self.tls = None - - -class NetworkRuleSet(msrest.serialization.Model): - """The network rule set for a container registry. - - All required parameters must be populated in order to send to Azure. - - :param default_action: Required. The default action of allow or deny when no other rules match. - Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.IPRule] - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', "Allow") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - - -class OperationDefinition(msrest.serialization.Model): - """The definition of a container registry operation. - - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationServiceSpecificationDefinition - """ - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDefinition, self).__init__(**kwargs) - self.origin = kwargs.get('origin', None) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplayDefinition(msrest.serialization.Model): - """The display information for a container registry operation. - - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The result of a request to list container registry operations. - - :param value: The list of container registry operations. Since this list may be incomplete, the - nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry - operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationLogSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring log. - - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationLogSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class OperationMetricSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring metric. - - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class OperationServiceSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring list. - - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationLogSpecificationDefinition] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, - 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecificationDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - self.log_specifications = kwargs.get('log_specifications', None) - - -class ParentProperties(msrest.serialization.Model): - """The properties of the connected registry parent. - - All required parameters must be populated in order to send to Azure. - - :param id: The resource ID of the parent to which the connected registry will be associated. - :type id: str - :param sync_properties: Required. The sync properties of the connected registry with its - parent. - :type sync_properties: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SyncProperties - """ - - _validation = { - 'sync_properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'sync_properties': {'key': 'syncProperties', 'type': 'SyncProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ParentProperties, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.sync_properties = kwargs['sync_properties'] - - -class PipelineRun(ProxyResource): - """An object that represents a pipeline run for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of a pipeline run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunRequest - :ivar response: The response of a pipeline run. - :vartype response: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline - run configuration has not changed. - :type force_update_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'request': {'key': 'properties.request', 'type': 'PipelineRunRequest'}, - 'response': {'key': 'properties.response', 'type': 'PipelineRunResponse'}, - 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRun, self).__init__(**kwargs) - self.provisioning_state = None - self.request = kwargs.get('request', None) - self.response = None - self.force_update_tag = kwargs.get('force_update_tag', None) - - -class PipelineRunListResult(msrest.serialization.Model): - """The result of a request to list pipeline runs for a container registry. - - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field - should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PipelineRun]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PipelineRunRequest(msrest.serialization.Model): - """The request properties provided for a pipeline run. - - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - """ - - _attribute_map = { - 'pipeline_resource_id': {'key': 'pipelineResourceId', 'type': 'str'}, - 'artifacts': {'key': 'artifacts', 'type': '[str]'}, - 'source': {'key': 'source', 'type': 'PipelineRunSourceProperties'}, - 'target': {'key': 'target', 'type': 'PipelineRunTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunRequest, self).__init__(**kwargs) - self.pipeline_resource_id = kwargs.get('pipeline_resource_id', None) - self.artifacts = kwargs.get('artifacts', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - - -class PipelineRunResponse(msrest.serialization.Model): - """The response properties returned for a pipeline run. - - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case - of failure. - :type pipeline_run_error_message: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'imported_artifacts': {'key': 'importedArtifacts', 'type': '[str]'}, - 'progress': {'key': 'progress', 'type': 'ProgressProperties'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'source': {'key': 'source', 'type': 'ImportPipelineSourceProperties'}, - 'target': {'key': 'target', 'type': 'ExportPipelineTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - 'trigger': {'key': 'trigger', 'type': 'PipelineTriggerDescriptor'}, - 'pipeline_run_error_message': {'key': 'pipelineRunErrorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunResponse, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.imported_artifacts = kwargs.get('imported_artifacts', None) - self.progress = kwargs.get('progress', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - self.trigger = kwargs.get('trigger', None) - self.pipeline_run_error_message = kwargs.get('pipeline_run_error_message', None) - - -class PipelineRunSourceProperties(msrest.serialization.Model): - """PipelineRunSourceProperties. - - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineRunTargetProperties(msrest.serialization.Model): - """PipelineRunTargetProperties. - - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineSourceTriggerDescriptor(msrest.serialization.Model): - """PipelineSourceTriggerDescriptor. - - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime - """ - - _attribute_map = { - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) - self.timestamp = kwargs.get('timestamp', None) - - -class PipelineSourceTriggerProperties(msrest.serialization.Model): - """PipelineSourceTriggerProperties. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The current status of the source trigger. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TriggerStatus - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerProperties, self).__init__(**kwargs) - self.status = kwargs.get('status', "Enabled") - - -class PipelineTriggerDescriptor(msrest.serialization.Model): - """PipelineTriggerDescriptor. - - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceTriggerDescriptor - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerDescriptor'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerDescriptor, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class PipelineTriggerProperties(msrest.serialization.Model): - """PipelineTriggerProperties. - - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceTriggerProperties - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerProperties, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class Policies(msrest.serialization.Model): - """The policies for a container registry. - - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RetentionPolicy - """ - - _attribute_map = { - 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, - 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(Policies, self).__init__(**kwargs) - self.quarantine_policy = kwargs.get('quarantine_policy', None) - self.trust_policy = kwargs.get('trust_policy', None) - self.retention_policy = kwargs.get('retention_policy', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateEndpointConnection(ProxyResource): - """An object that represents a private endpoint connection for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of private endpoint connection resource. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """The result of a request to list private endpoint connections for a container registry. - - :param value: The list of private endpoint connections. Since this list may be incomplete, the - nextLink field should be used to request the next list of private endpoint connections. - :type value: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint - connections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(msrest.serialization.Model): - """A resource that supports private link capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The resource type is private link resource. - :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'type': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.type = None - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.group_id = kwargs.get('group_id', None) - self.required_members = kwargs.get('required_members', None) - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """The result of a request to list private link resources for a container registry. - - :param value: The list of private link resources. Since this list may be incomplete, the - nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The state of a private link service connection. - - :param status: The private link service connection status. Possible values include: "Approved", - "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ProgressProperties(msrest.serialization.Model): - """ProgressProperties. - - :param percentage: The percentage complete of the copy operation. - :type percentage: str - """ - - _attribute_map = { - 'percentage': {'key': 'percentage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProgressProperties, self).__init__(**kwargs) - self.percentage = kwargs.get('percentage', None) - - -class QuarantinePolicy(msrest.serialization.Model): - """The quarantine policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuarantinePolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - - -class RegenerateCredentialParameters(msrest.serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateCredentialParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.system_data = None - - -class Registry(Resource): - """An object that represents a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties - :ivar login_server: The URL that can be used to log into the container registry. - :vartype login_server: str - :ivar creation_date: The creation date of the container registry in ISO8601 format. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the container registry at the time the - operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", - "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :ivar status: The status of the container registry at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :ivar data_endpoint_host_names: List of host names that will serve data when - dataEndpointEnabled is true. - :vartype data_endpoint_host_names: list[str] - :ivar private_endpoint_connections: List of private endpoint connections for a container - registry. - :vartype private_endpoint_connections: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleBypassOptions - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. - Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ZoneRedundancy - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'sku': {'required': True}, - 'login_server': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'data_endpoint_host_names': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'data_endpoint_host_names': {'key': 'properties.dataEndpointHostNames', 'type': '[str]'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, - 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Registry, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.identity = kwargs.get('identity', None) - self.login_server = None - self.creation_date = None - self.provisioning_state = None - self.status = None - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.data_endpoint_host_names = None - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - self.zone_redundancy = kwargs.get('zone_redundancy', None) - self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', False) - - -class RegistryListCredentialsResult(msrest.serialization.Model): - """The response from the ListCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class RegistryListResult(msrest.serialization.Model): - """The result of a request to list container registries. - - :param value: The list of container registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Registry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegistryNameCheckRequest(msrest.serialization.Model): - """A request to check whether a container registry name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the container registry. - :type name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Has constant value: - "Microsoft.ContainerRegistry/registries". - :vartype type: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - **kwargs - ): - super(RegistryNameCheckRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class RegistryNameStatus(msrest.serialization.Model): - """The result of a request to check the availability of a container registry name. - - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryNameStatus, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class RegistryPassword(msrest.serialization.Model): - """The login password for the container registry. - - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName - :param value: The password value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPassword, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class RegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a container registry. - - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleBypassOptions - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUpdateParameters, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.admin_user_enabled = kwargs.get('admin_user_enabled', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', None) - - -class RegistryUsage(msrest.serialization.Model): - """The quota usage for a container registry. - - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsageUnit - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsage, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.limit = kwargs.get('limit', None) - self.current_value = kwargs.get('current_value', None) - self.unit = kwargs.get('unit', None) - - -class RegistryUsageListResult(msrest.serialization.Model): - """The result of a request to get container registry quota usages. - - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RegistryUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Replication(Resource): - """An object that represents a replication for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of the replication at the time the operation - was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :ivar status: The status of the replication at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry - replication. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ZoneRedundancy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Replication, self).__init__(**kwargs) - self.provisioning_state = None - self.status = None - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', True) - self.zone_redundancy = kwargs.get('zone_redundancy', None) - - -class ReplicationListResult(msrest.serialization.Model): - """The result of a request to list replications for a container registry. - - :param value: The list of replications. Since this list may be incomplete, the nextLink field - should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Replication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationUpdateParameters(msrest.serialization.Model): - """The parameters for updating a replication. - - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', None) - - -class Request(msrest.serialization.Model): - """The request that generated the event. - - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the - event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the - http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'addr': {'key': 'addr', 'type': 'str'}, - 'host': {'key': 'host', 'type': 'str'}, - 'method': {'key': 'method', 'type': 'str'}, - 'useragent': {'key': 'useragent', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.addr = kwargs.get('addr', None) - self.host = kwargs.get('host', None) - self.method = kwargs.get('method', None) - self.useragent = kwargs.get('useragent', None) - - -class RetentionPolicy(msrest.serialization.Model): - """The retention policy for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int - :ivar last_updated_time: The timestamp when the policy was last updated. - :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus - """ - - _validation = { - 'last_updated_time': {'readonly': True}, - } - - _attribute_map = { - 'days': {'key': 'days', 'type': 'int'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RetentionPolicy, self).__init__(**kwargs) - self.days = kwargs.get('days', 7) - self.last_updated_time = None - self.status = kwargs.get('status', None) - - -class ScopeMap(ProxyResource): - """An object that represents a scope map for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str - :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. - :vartype type_properties_type: str - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. - E.g. repositories/repository-name/content/read, - repositories/repository-name/metadata/write. - :type actions: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'type_properties_type': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMap, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.type_properties_type = None - self.creation_date = None - self.provisioning_state = None - self.actions = kwargs.get('actions', None) - - -class ScopeMapListResult(msrest.serialization.Model): - """The result of a request to list scope maps for a container registry. - - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field - should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScopeMap]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ScopeMapUpdateParameters(msrest.serialization.Model): - """The properties for updating the scope map. - - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. - E.g. repositories/repository-name/pull, - repositories/repository-name/delete. - :type actions: list[str] - """ - - _attribute_map = { - 'description': {'key': 'properties.description', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapUpdateParameters, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.actions = kwargs.get('actions', None) - - -class Sku(msrest.serialization.Model): - """The SKU of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name of the container registry. Required for registry creation. - Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SkuName - :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class Source(msrest.serialization.Model): - """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - - :param addr: The IP or hostname and the port of the registry node that generated the event. - Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str - """ - - _attribute_map = { - 'addr': {'key': 'addr', 'type': 'str'}, - 'instance_id': {'key': 'instanceID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Source, self).__init__(**kwargs) - self.addr = kwargs.get('addr', None) - self.instance_id = kwargs.get('instance_id', None) - - -class Status(msrest.serialization.Model): - """The status of an Azure resource at the time the operation was called. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_status: The short label for the status. - :vartype display_status: str - :ivar message: The detailed message for the status, including alerts and error messages. - :vartype message: str - :ivar timestamp: The timestamp when the status was changed to the current value. - :vartype timestamp: ~datetime.datetime - """ - - _validation = { - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'timestamp': {'readonly': True}, - } - - _attribute_map = { - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Status, self).__init__(**kwargs) - self.display_status = None - self.message = None - self.timestamp = None - - -class StatusDetailProperties(msrest.serialization.Model): - """The status detail properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The component of the connected registry corresponding to the status. - :vartype type: str - :ivar code: The code of the status. - :vartype code: str - :ivar description: The description of the status. - :vartype description: str - :ivar timestamp: The timestamp of the status. - :vartype timestamp: ~datetime.datetime - :ivar correlation_id: The correlation ID of the status. - :vartype correlation_id: str - """ - - _validation = { - 'type': {'readonly': True}, - 'code': {'readonly': True}, - 'description': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'correlation_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StatusDetailProperties, self).__init__(**kwargs) - self.type = None - self.code = None - self.description = None - self.timestamp = None - self.correlation_id = None - - -class SyncProperties(msrest.serialization.Model): - """The sync properties of the connected registry with its parent. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param token_id: Required. The resource ID of the ACR token used to authenticate the connected - registry to its parent during sync. - :type token_id: str - :param schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. - Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: Required. The period of time for which a message is available to sync - before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per - ISO8601. - :type message_ttl: ~datetime.timedelta - :ivar last_sync_time: The last time a sync occurred between the connected registry and its - parent. - :vartype last_sync_time: ~datetime.datetime - :ivar gateway_endpoint: The gateway endpoint used by the connected registry to communicate with - its parent. - :vartype gateway_endpoint: str - """ - - _validation = { - 'token_id': {'required': True}, - 'message_ttl': {'required': True}, - 'last_sync_time': {'readonly': True}, - 'gateway_endpoint': {'readonly': True}, - } - - _attribute_map = { - 'token_id': {'key': 'tokenId', 'type': 'str'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, - 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'gateway_endpoint': {'key': 'gatewayEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncProperties, self).__init__(**kwargs) - self.token_id = kwargs['token_id'] - self.schedule = kwargs.get('schedule', None) - self.sync_window = kwargs.get('sync_window', None) - self.message_ttl = kwargs['message_ttl'] - self.last_sync_time = None - self.gateway_endpoint = None - - -class SyncUpdateProperties(msrest.serialization.Model): - """The parameters for updating the sync properties of the connected registry with its parent. - - :param schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. - Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: The period of time for which a message is available to sync before it is - expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type message_ttl: ~datetime.timedelta - """ - - _attribute_map = { - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, - 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncUpdateProperties, self).__init__(**kwargs) - self.schedule = kwargs.get('schedule', None) - self.sync_window = kwargs.get('sync_window', None) - self.message_ttl = kwargs.get('message_ttl', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Target(msrest.serialization.Model): - """The target of the event. - - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str - """ - - _attribute_map = { - 'media_type': {'key': 'mediaType', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'long'}, - 'digest': {'key': 'digest', 'type': 'str'}, - 'length': {'key': 'length', 'type': 'long'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Target, self).__init__(**kwargs) - self.media_type = kwargs.get('media_type', None) - self.size = kwargs.get('size', None) - self.digest = kwargs.get('digest', None) - self.length = kwargs.get('length', None) - self.repository = kwargs.get('repository', None) - self.url = kwargs.get('url', None) - self.tag = kwargs.get('tag', None) - self.name = kwargs.get('name', None) - self.version = kwargs.get('version', None) - - -class TlsCertificateProperties(msrest.serialization.Model): - """The TLS certificate properties of the connected registry login server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of certificate location. Possible values include: "LocalDirectory". - :vartype type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.CertificateType - :ivar location: Indicates the location of the certificates. - :vartype location: str - """ - - _validation = { - 'type': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TlsCertificateProperties, self).__init__(**kwargs) - self.type = None - self.location = None - - -class TlsProperties(msrest.serialization.Model): - """The TLS properties of the connected registry login server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: Indicates whether HTTPS is enabled for the login server. Possible values include: - "Enabled", "Disabled". - :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TlsStatus - :ivar certificate: The certificate used to configure HTTPS for the login server. - :vartype certificate: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TlsCertificateProperties - """ - - _validation = { - 'status': {'readonly': True}, - 'certificate': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'TlsCertificateProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TlsProperties, self).__init__(**kwargs) - self.status = None - self.certificate = None - - -class Token(ProxyResource): - """An object that represents a token for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Token, self).__init__(**kwargs) - self.creation_date = None - self.provisioning_state = None - self.scope_map_id = kwargs.get('scope_map_id', None) - self.credentials = kwargs.get('credentials', None) - self.status = kwargs.get('status', None) - - -class TokenCertificate(msrest.serialization.Model): - """The properties of a certificate used for authenticating a token. - - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format - that will be used for authenticating the token. - :type encoded_pem_certificate: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'encoded_pem_certificate': {'key': 'encodedPemCertificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCertificate, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.expiry = kwargs.get('expiry', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.encoded_pem_certificate = kwargs.get('encoded_pem_certificate', None) - - -class TokenCredentialsProperties(msrest.serialization.Model): - """The properties of the credentials that can be used for authenticating the token. - - :param certificates: - :type certificates: - list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'certificates': {'key': 'certificates', 'type': '[TokenCertificate]'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCredentialsProperties, self).__init__(**kwargs) - self.certificates = kwargs.get('certificates', None) - self.passwords = kwargs.get('passwords', None) - - -class TokenListResult(msrest.serialization.Model): - """The result of a request to list tokens for a container registry. - - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should - be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Token]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TokenPassword(msrest.serialization.Model): - """The password that will be used for authenticating the token of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName - :ivar value: The password value. - :vartype value: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenPassword, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - self.value = None - - -class TokenUpdateParameters(msrest.serialization.Model): - """The parameters for updating a token. - - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCredentialsProperties - """ - - _attribute_map = { - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenUpdateParameters, self).__init__(**kwargs) - self.scope_map_id = kwargs.get('scope_map_id', None) - self.status = kwargs.get('status', None) - self.credentials = kwargs.get('credentials', None) - - -class TrustPolicy(msrest.serialization.Model): - """The content trust policy for a container registry. - - :param type: The type of trust policy. Possible values include: "Notary". Default value: - "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustPolicy, self).__init__(**kwargs) - self.type = kwargs.get('type', "Notary") - self.status = kwargs.get('status', None) - - -class UserIdentityProperties(msrest.serialization.Model): - """UserIdentityProperties. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual network rule. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - - -class Webhook(Resource): - """An object that represents a webhook for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] - :ivar provisioning_state: The provisioning state of the webhook at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Webhook, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - self.provisioning_state = None - - -class WebhookCreateParameters(msrest.serialization.Model): - """The parameters for creating a webhook. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the - resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - - -class WebhookListResult(msrest.serialization.Model): - """The result of a request to list webhooks for a container registry. - - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Webhook]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WebhookUpdateParameters(msrest.serialization.Model): - """The parameters for updating a webhook. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py index 9cdc96641349..628956d2d28e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py @@ -38,6 +38,8 @@ def __init__( self, **kwargs ): + """ + """ super(ActivationProperties, self).__init__(**kwargs) self.status = None @@ -45,12 +47,12 @@ def __init__( class ActiveDirectoryObject(msrest.serialization.Model): """The Active Directory Object that will be used for authenticating the token of a container registry. - :param object_id: The user/group/application object ID for Active Directory Object that will be + :ivar object_id: The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that + :vartype object_id: str + :ivar tenant_id: The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. - :type tenant_id: str + :vartype tenant_id: str """ _attribute_map = { @@ -65,6 +67,14 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword object_id: The user/group/application object ID for Active Directory Object that will + be used for authenticating the token of a container registry. + :paramtype object_id: str + :keyword tenant_id: The tenant ID of user/group/application object Active Directory Object that + will be used for authenticating the token of a container registry. + :paramtype tenant_id: str + """ super(ActiveDirectoryObject, self).__init__(**kwargs) self.object_id = object_id self.tenant_id = tenant_id @@ -73,9 +83,9 @@ def __init__( class Actor(msrest.serialization.Model): """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :param name: The subject or username associated with the request context that generated the + :ivar name: The subject or username associated with the request context that generated the event. - :type name: str + :vartype name: str """ _attribute_map = { @@ -88,6 +98,11 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The subject or username associated with the request context that generated the + event. + :paramtype name: str + """ super(Actor, self).__init__(**kwargs) self.name = name @@ -97,10 +112,10 @@ class CallbackConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] + :ivar service_uri: Required. The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] """ _validation = { @@ -119,6 +134,12 @@ def __init__( custom_headers: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword service_uri: Required. The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + """ super(CallbackConfig, self).__init__(**kwargs) self.service_uri = service_uri self.custom_headers = custom_headers @@ -157,6 +178,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -181,9 +204,9 @@ class ConnectedRegistry(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param mode: The mode of the connected registry resource that indicates the permissions of the + :ivar mode: The mode of the connected registry resource that indicates the permissions of the registry. Possible values include: "Registry", "Mirror". - :type mode: str or + :vartype mode: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryMode :ivar version: The current version of ACR runtime on the connected registry. :vartype version: str @@ -196,16 +219,16 @@ class ConnectedRegistry(ProxyResource): :ivar activation: The activation properties of the connected registry. :vartype activation: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ActivationProperties - :param parent: The parent of the connected registry. - :type parent: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ParentProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + :ivar parent: The parent of the connected registry. + :vartype parent: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ParentProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to the connected registry. - :type client_token_ids: list[str] - :param login_server: The login server properties of the connected registry. - :type login_server: + :vartype client_token_ids: list[str] + :ivar login_server: The login server properties of the connected registry. + :vartype login_server: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoginServerProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties :ivar status_details: The list of current statuses of the connected registry. :vartype status_details: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.StatusDetailProperties] @@ -252,6 +275,22 @@ def __init__( logging: Optional["LoggingProperties"] = None, **kwargs ): + """ + :keyword mode: The mode of the connected registry resource that indicates the permissions of + the registry. Possible values include: "Registry", "Mirror". + :paramtype mode: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryMode + :keyword parent: The parent of the connected registry. + :paramtype parent: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ParentProperties + :keyword client_token_ids: The list of the ACR token resource IDs used to authenticate clients + to the connected registry. + :paramtype client_token_ids: list[str] + :keyword login_server: The login server properties of the connected registry. + :paramtype login_server: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoginServerProperties + :keyword logging: The logging properties of the connected registry. + :paramtype logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties + """ super(ConnectedRegistry, self).__init__(**kwargs) self.provisioning_state = None self.mode = mode @@ -269,11 +308,12 @@ def __init__( class ConnectedRegistryListResult(msrest.serialization.Model): """The result of a request to list connected registries for a container registry. - :param value: The list of connected registries. Since this list may be incomplete, the nextLink + :ivar value: The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next list of connected registries. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] - :param next_link: The URI that can be used to request the next list of connected registries. - :type next_link: str + :vartype value: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] + :ivar next_link: The URI that can be used to request the next list of connected registries. + :vartype next_link: str """ _attribute_map = { @@ -288,6 +328,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of connected registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of connected registries. + :paramtype value: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] + :keyword next_link: The URI that can be used to request the next list of connected registries. + :paramtype next_link: str + """ super(ConnectedRegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -296,14 +344,14 @@ def __init__( class ConnectedRegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a connected registry. - :param sync_properties: The sync properties of the connected registry with its parent. - :type sync_properties: + :ivar sync_properties: The sync properties of the connected registry with its parent. + :vartype sync_properties: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SyncUpdateProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to the connected registry. - :type client_token_ids: list[str] + :vartype client_token_ids: list[str] """ _attribute_map = { @@ -320,6 +368,16 @@ def __init__( client_token_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword sync_properties: The sync properties of the connected registry with its parent. + :paramtype sync_properties: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SyncUpdateProperties + :keyword logging: The logging properties of the connected registry. + :paramtype logging: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LoggingProperties + :keyword client_token_ids: The list of the ACR token resource IDs used to authenticate clients + to the connected registry. + :paramtype client_token_ids: list[str] + """ super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) self.sync_properties = sync_properties self.logging = logging @@ -329,11 +387,12 @@ def __init__( class EncryptionProperty(msrest.serialization.Model): """EncryptionProperty. - :param status: Indicates whether or not the encryption is enabled for container registry. + :ivar status: Indicates whether or not the encryption is enabled for container registry. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: + :vartype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionStatus + :ivar key_vault_properties: Key vault properties. + :vartype key_vault_properties: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.KeyVaultProperties """ @@ -349,6 +408,15 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionStatus + :keyword key_vault_properties: Key vault properties. + :paramtype key_vault_properties: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.KeyVaultProperties + """ super(EncryptionProperty, self).__init__(**kwargs) self.status = status self.key_vault_properties = key_vault_properties @@ -357,8 +425,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the Azure Container Registry service. - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ErrorResponseBody + :ivar error: Azure container registry build API error body. + :vartype error: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ErrorResponseBody """ _attribute_map = { @@ -371,6 +439,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure container registry build API error body. + :paramtype error: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -380,15 +452,16 @@ class ErrorResponseBody(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str + :ivar details: an array of additional nested error response info objects, as described by this contract. - :type details: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.InnerErrorDescription + :vartype details: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.InnerErrorDescription] """ _validation = { @@ -400,7 +473,7 @@ class ErrorResponseBody(msrest.serialization.Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, + 'details': {'key': 'details', 'type': '[InnerErrorDescription]'}, } def __init__( @@ -409,9 +482,21 @@ def __init__( code: str, message: str, target: Optional[str] = None, - details: Optional["InnerErrorDescription"] = None, + details: Optional[List["InnerErrorDescription"]] = None, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + :keyword details: an array of additional nested error response info objects, as described by + this contract. + :paramtype details: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.InnerErrorDescription] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -422,8 +507,8 @@ def __init__( class EventInfo(msrest.serialization.Model): """The basic information of an event. - :param id: The event ID. - :type id: str + :ivar id: The event ID. + :vartype id: str """ _attribute_map = { @@ -436,6 +521,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + """ super(EventInfo, self).__init__(**kwargs) self.id = id @@ -443,13 +532,13 @@ def __init__( class Event(EventInfo): """The event for a webhook. - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: + :ivar id: The event ID. + :vartype id: str + :ivar event_request_message: The event request message sent to the service URI. + :vartype event_request_message: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventResponseMessage """ @@ -467,6 +556,16 @@ def __init__( event_response_message: Optional["EventResponseMessage"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword event_request_message: The event request message sent to the service URI. + :paramtype event_request_message: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventRequestMessage + :keyword event_response_message: The event response message received from the service URI. + :paramtype event_response_message: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventResponseMessage + """ super(Event, self).__init__(id=id, **kwargs) self.event_request_message = event_request_message self.event_response_message = event_response_message @@ -475,22 +574,22 @@ def __init__( class EventContent(msrest.serialization.Model): """The content of the event request message. - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar target: The target of the event. + :vartype target: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Request + :ivar actor: The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor + :vartype actor: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Actor + :ivar source: The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Source + :vartype source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Source """ _attribute_map = { @@ -515,6 +614,24 @@ def __init__( source: Optional["Source"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword timestamp: The time at which the event occurred. + :paramtype timestamp: ~datetime.datetime + :keyword action: The action that encompasses the provided event. + :paramtype action: str + :keyword target: The target of the event. + :paramtype target: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Target + :keyword request: The request that generated the event. + :paramtype request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Request + :keyword actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :paramtype actor: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Actor + :keyword source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :paramtype source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Source + """ super(EventContent, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -528,11 +645,11 @@ def __init__( class EventListResult(msrest.serialization.Model): """The result of a request to list events for a webhook. - :param value: The list of events. Since this list may be incomplete, the nextLink field should + :ivar value: The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Event] + :ivar next_link: The URI that can be used to request the next list of events. + :vartype next_link: str """ _attribute_map = { @@ -547,6 +664,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of events. Since this list may be incomplete, the nextLink field + should be used to request the next list of events. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Event] + :keyword next_link: The URI that can be used to request the next list of events. + :paramtype next_link: str + """ super(EventListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -555,16 +679,16 @@ def __init__( class EventRequestMessage(msrest.serialization.Model): """The event request message sent to the service URI. - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventContent + :ivar headers: The headers of the event request message. + :vartype headers: dict[str, str] + :ivar method: The HTTP method used to send the event request message. + :vartype method: str + :ivar request_uri: The URI used to send the event request message. + :vartype request_uri: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -585,6 +709,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event request message. + :paramtype content: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventContent + :keyword headers: The headers of the event request message. + :paramtype headers: dict[str, str] + :keyword method: The HTTP method used to send the event request message. + :paramtype method: str + :keyword request_uri: The URI used to send the event request message. + :paramtype request_uri: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventRequestMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -596,16 +732,16 @@ def __init__( class EventResponseMessage(msrest.serialization.Model): """The event response message received from the service URI. - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event response message. + :vartype content: str + :ivar headers: The headers of the event response message. + :vartype headers: dict[str, str] + :ivar reason_phrase: The reason phrase of the event response message. + :vartype reason_phrase: str + :ivar status_code: The status code of the event response message. + :vartype status_code: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -626,6 +762,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event response message. + :paramtype content: str + :keyword headers: The headers of the event response message. + :paramtype headers: dict[str, str] + :keyword reason_phrase: The reason phrase of the event response message. + :paramtype reason_phrase: str + :keyword status_code: The status code of the event response message. + :paramtype status_code: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventResponseMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -647,15 +795,15 @@ class ExportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: + :ivar location: The location of the export pipeline. + :vartype location: str + :ivar identity: The identity of the export pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :ivar target: The target properties of the export pipeline. + :vartype target: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -693,6 +841,19 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the export pipeline. + :paramtype location: str + :keyword identity: The identity of the export pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :keyword target: The target properties of the export pipeline. + :paramtype target: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineTargetProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineOptions] + """ super(ExportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -704,11 +865,11 @@ def __init__( class ExportPipelineListResult(msrest.serialization.Model): """The result of a request to list export pipelines for a container registry. - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -723,6 +884,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of export pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of export pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ExportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -733,15 +901,15 @@ class ExportPipelineTargetProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. + :ivar type: The type of target for the export pipeline. + :vartype type: str + :ivar uri: The target uri of the export pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -762,6 +930,17 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of target for the export pipeline. + :paramtype type: str + :keyword uri: The target uri of the export pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + token. + :paramtype key_vault_uri: str + """ super(ExportPipelineTargetProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -771,14 +950,15 @@ def __init__( class GenerateCredentialsParameters(msrest.serialization.Model): """The parameters used to generate credentials for a specified token or user of a container registry. - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become + :ivar token_id: The resource ID of the token for which credentials have to be generated. + :vartype token_id: str + :ivar expiry: The expiry date of the generated credentials after which the credentials become invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or + :vartype expiry: ~datetime.datetime + :ivar name: Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName + :vartype name: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName """ _attribute_map = { @@ -795,6 +975,17 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword token_id: The resource ID of the token for which credentials have to be generated. + :paramtype token_id: str + :keyword expiry: The expiry date of the generated credentials after which the credentials + become invalid. + :paramtype expiry: ~datetime.datetime + :keyword name: Specifies name of the password which should be regenerated if any -- password1 + or password2. Possible values include: "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName + """ super(GenerateCredentialsParameters, self).__init__(**kwargs) self.token_id = token_id self.expiry = expiry @@ -804,10 +995,11 @@ def __init__( class GenerateCredentialsResult(msrest.serialization.Model): """The response from the GenerateCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] """ _attribute_map = { @@ -822,6 +1014,13 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] + """ super(GenerateCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -830,20 +1029,20 @@ def __init__( class IdentityProperties(msrest.serialization.Model): """Managed identity for the resource. - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or + :vartype type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.containerregistry.v2020_11_01_preview.models.UserIdentityProperties] """ @@ -863,6 +1062,23 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.UserIdentityProperties] + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id @@ -875,18 +1091,18 @@ class ImportImageParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + :ivar source: Required. The source of the image. + :vartype source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportSource + :ivar target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only + :vartype target_tags: list[str] + :ivar untagged_target_repositories: List of strings of repository names to do a manifest only copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + :vartype untagged_target_repositories: list[str] + :ivar mode: When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportMode + :vartype mode: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportMode """ _validation = { @@ -909,6 +1125,20 @@ def __init__( mode: Optional[Union[str, "ImportMode"]] = "NoForce", **kwargs ): + """ + :keyword source: Required. The source of the image. + :paramtype source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportSource + :keyword target_tags: List of strings of the form repo[:tag]. When tag is omitted the source + will be used (or 'latest' if source tag is also omitted). + :paramtype target_tags: list[str] + :keyword untagged_target_repositories: List of strings of repository names to do a manifest + only copy. No tag will be created. + :paramtype untagged_target_repositories: list[str] + :keyword mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :paramtype mode: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportMode + """ super(ImportImageParameters, self).__init__(**kwargs) self.source = source self.target_tags = target_tags @@ -929,18 +1159,18 @@ class ImportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: + :ivar location: The location of the import pipeline. + :vartype location: str + :ivar identity: The identity of the import pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :ivar source: The source properties of the import pipeline. + :vartype source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: + :ivar trigger: The properties that describe the trigger of the import pipeline. + :vartype trigger: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -980,6 +1210,22 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the import pipeline. + :paramtype location: str + :keyword identity: The identity of the import pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :keyword source: The source properties of the import pipeline. + :paramtype source: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineSourceProperties + :keyword trigger: The properties that describe the trigger of the import pipeline. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineTriggerProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineOptions] + """ super(ImportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -992,11 +1238,11 @@ def __init__( class ImportPipelineListResult(msrest.serialization.Model): """The result of a request to list import pipelines for a container registry. - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -1011,6 +1257,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of import pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of import pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ImportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1021,16 +1274,17 @@ class ImportPipelineSourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of source for the import pipeline. Possible values include: + :ivar type: The type of source for the import pipeline. Possible values include: "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. + :vartype type: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceType + :ivar uri: The source uri of the import pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -1051,6 +1305,19 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of source for the import pipeline. Possible values include: + "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceType + :keyword uri: The source uri of the import pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + token. + :paramtype key_vault_uri: str + """ super(ImportPipelineSourceProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -1062,18 +1329,18 @@ class ImportSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: + :ivar resource_id: The resource identifier of the source Azure Container Registry. + :vartype resource_id: str + :ivar registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :vartype registry_uri: str + :ivar credentials: Credentials used when importing from a registry uri. + :vartype credentials: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. + :ivar source_image: Required. Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str + :vartype source_image: str """ _validation = { @@ -1096,6 +1363,20 @@ def __init__( credentials: Optional["ImportSourceCredentials"] = None, **kwargs ): + """ + :keyword resource_id: The resource identifier of the source Azure Container Registry. + :paramtype resource_id: str + :keyword registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :paramtype registry_uri: str + :keyword credentials: Credentials used when importing from a registry uri. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportSourceCredentials + :keyword source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype source_image: str + """ super(ImportSource, self).__init__(**kwargs) self.resource_id = resource_id self.registry_uri = registry_uri @@ -1108,10 +1389,10 @@ class ImportSourceCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: Required. The password used to authenticate with the source registry. + :vartype password: str """ _validation = { @@ -1130,6 +1411,12 @@ def __init__( username: Optional[str] = None, **kwargs ): + """ + :keyword username: The username to authenticate with the source registry. + :paramtype username: str + :keyword password: Required. The password used to authenticate with the source registry. + :paramtype password: str + """ super(ImportSourceCredentials, self).__init__(**kwargs) self.username = username self.password = password @@ -1140,12 +1427,12 @@ class InnerErrorDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str """ _validation = { @@ -1167,6 +1454,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + """ super(InnerErrorDescription, self).__init__(**kwargs) self.code = code self.message = message @@ -1178,11 +1473,11 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar action: The action of IP ACL rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str + :vartype ip_address_or_range: str """ _validation = { @@ -1201,6 +1496,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of IP ACL rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + """ super(IPRule, self).__init__(**kwargs) self.action = action self.ip_address_or_range = ip_address_or_range @@ -1211,13 +1513,13 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str + :ivar key_identifier: Key vault uri to access the encryption key. + :vartype key_identifier: str :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of the key that is actually used for encryption. :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str + :ivar identity: The client id of the identity which will be used to access key vault. + :vartype identity: str :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. :vartype key_rotation_enabled: bool :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. @@ -1245,6 +1547,12 @@ def __init__( identity: Optional[str] = None, **kwargs ): + """ + :keyword key_identifier: Key vault uri to access the encryption key. + :paramtype key_identifier: str + :keyword identity: The client id of the identity which will be used to access key vault. + :paramtype identity: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_identifier = key_identifier self.versioned_key_identifier = None @@ -1256,12 +1564,12 @@ def __init__( class LoggingProperties(msrest.serialization.Model): """The logging properties of the connected registry. - :param log_level: The verbosity of logs persisted on the connected registry. Possible values + :ivar log_level: The verbosity of logs persisted on the connected registry. Possible values include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". - :type log_level: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LogLevel - :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. + :vartype log_level: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LogLevel + :ivar audit_log_status: Indicates whether audit logs are enabled on the connected registry. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type audit_log_status: str or + :vartype audit_log_status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.AuditLogStatus """ @@ -1277,6 +1585,15 @@ def __init__( audit_log_status: Optional[Union[str, "AuditLogStatus"]] = "Disabled", **kwargs ): + """ + :keyword log_level: The verbosity of logs persisted on the connected registry. Possible values + include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". + :paramtype log_level: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LogLevel + :keyword audit_log_status: Indicates whether audit logs are enabled on the connected registry. + Possible values include: "Enabled", "Disabled". Default value: "Disabled". + :paramtype audit_log_status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.AuditLogStatus + """ super(LoggingProperties, self).__init__(**kwargs) self.log_level = log_level self.audit_log_status = audit_log_status @@ -1307,6 +1624,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoginServerProperties, self).__init__(**kwargs) self.host = None self.tls = None @@ -1317,15 +1636,15 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param default_action: Required. The default action of allow or deny when no other rules match. + :ivar default_action: Required. The default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or + :vartype default_action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: + :ivar virtual_network_rules: The virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.IPRule] + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.IPRule] """ _validation = { @@ -1346,6 +1665,17 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword default_action: Required. The default action of allow or deny when no other rules + match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.DefaultAction + :keyword virtual_network_rules: The virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.VirtualNetworkRule] + :keyword ip_rules: The IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.IPRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules @@ -1355,15 +1685,15 @@ def __init__( class OperationDefinition(msrest.serialization.Model): """The definition of a container registry operation. - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: + :ivar origin: The origin information of the container registry operation. + :vartype origin: str + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationDisplayDefinition - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationServiceSpecificationDefinition """ @@ -1383,6 +1713,18 @@ def __init__( service_specification: Optional["OperationServiceSpecificationDefinition"] = None, **kwargs ): + """ + :keyword origin: The origin information of the container registry operation. + :paramtype origin: str + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationDisplayDefinition + :keyword service_specification: The definition of Azure Monitoring service. + :paramtype service_specification: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationServiceSpecificationDefinition + """ super(OperationDefinition, self).__init__(**kwargs) self.origin = origin self.name = name @@ -1393,14 +1735,14 @@ def __init__( class OperationDisplayDefinition(msrest.serialization.Model): """The display information for a container registry operation. - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str """ _attribute_map = { @@ -1419,6 +1761,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ super(OperationDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1429,12 +1781,13 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The result of a request to list container registry operations. - :param value: The list of container registry operations. Since this list may be incomplete, the + :ivar value: The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry + :vartype value: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry operations. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1449,6 +1802,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1457,12 +1819,12 @@ def __init__( class OperationLogSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring log. - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str + :ivar name: Log name. + :vartype name: str + :ivar display_name: Log display name. + :vartype display_name: str + :ivar blob_duration: Log blob duration. + :vartype blob_duration: str """ _attribute_map = { @@ -1479,6 +1841,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Log name. + :paramtype name: str + :keyword display_name: Log display name. + :paramtype display_name: str + :keyword blob_duration: Log blob duration. + :paramtype blob_duration: str + """ super(OperationLogSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1488,18 +1858,18 @@ def __init__( class OperationMetricSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring metric. - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str + :ivar name: Metric name. + :vartype name: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -1522,6 +1892,20 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Metric name. + :paramtype name: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword unit: Metric unit. + :paramtype unit: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword internal_metric_name: Internal metric name. + :paramtype internal_metric_name: str + """ super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1534,11 +1918,11 @@ def __init__( class OperationServiceSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring list. - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: + :ivar log_specifications: A list of Azure Monitoring log definitions. + :vartype log_specifications: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationLogSpecificationDefinition] """ @@ -1554,6 +1938,14 @@ def __init__( log_specifications: Optional[List["OperationLogSpecificationDefinition"]] = None, **kwargs ): + """ + :keyword metric_specifications: A list of Azure Monitoring metrics definition. + :paramtype metric_specifications: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationMetricSpecificationDefinition] + :keyword log_specifications: A list of Azure Monitoring log definitions. + :paramtype log_specifications: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationLogSpecificationDefinition] + """ super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -1564,11 +1956,11 @@ class ParentProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: The resource ID of the parent to which the connected registry will be associated. - :type id: str - :param sync_properties: Required. The sync properties of the connected registry with its - parent. - :type sync_properties: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SyncProperties + :ivar id: The resource ID of the parent to which the connected registry will be associated. + :vartype id: str + :ivar sync_properties: Required. The sync properties of the connected registry with its parent. + :vartype sync_properties: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SyncProperties """ _validation = { @@ -1587,6 +1979,14 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The resource ID of the parent to which the connected registry will be associated. + :paramtype id: str + :keyword sync_properties: Required. The sync properties of the connected registry with its + parent. + :paramtype sync_properties: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SyncProperties + """ super(ParentProperties, self).__init__(**kwargs) self.id = id self.sync_properties = sync_properties @@ -1609,13 +2009,13 @@ class PipelineRun(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunRequest + :ivar request: The request parameters for a pipeline run. + :vartype request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunRequest :ivar response: The response of a pipeline run. :vartype response: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline + :ivar force_update_tag: How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - :type force_update_tag: str + :vartype force_update_tag: str """ _validation = { @@ -1645,6 +2045,13 @@ def __init__( force_update_tag: Optional[str] = None, **kwargs ): + """ + :keyword request: The request parameters for a pipeline run. + :paramtype request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunRequest + :keyword force_update_tag: How the pipeline run should be forced to recreate even if the + pipeline run configuration has not changed. + :paramtype force_update_tag: str + """ super(PipelineRun, self).__init__(**kwargs) self.provisioning_state = None self.request = request @@ -1655,11 +2062,11 @@ def __init__( class PipelineRunListResult(msrest.serialization.Model): """The result of a request to list pipeline runs for a container registry. - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field + :ivar value: The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -1674,6 +2081,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of pipeline runs. Since this list may be incomplete, the nextLink + field should be used to request the next list of pipeline runs. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(PipelineRunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1682,21 +2096,21 @@ def __init__( class PipelineRunRequest(msrest.serialization.Model): """The request properties provided for a pipeline run. - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. + :ivar pipeline_resource_id: The resource ID of the pipeline to run. + :vartype pipeline_resource_id: str + :ivar artifacts: List of source artifacts to be transferred by the pipeline. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: + :vartype artifacts: list[str] + :ivar source: The source properties of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: + :ivar target: The target properties of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str """ _attribute_map = { @@ -1717,6 +2131,23 @@ def __init__( catalog_digest: Optional[str] = None, **kwargs ): + """ + :keyword pipeline_resource_id: The resource ID of the pipeline to run. + :paramtype pipeline_resource_id: str + :keyword artifacts: List of source artifacts to be transferred by the pipeline. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype artifacts: list[str] + :keyword source: The source properties of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunSourceProperties + :keyword target: The target properties of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + """ super(PipelineRunRequest, self).__init__(**kwargs) self.pipeline_resource_id = pipeline_resource_id self.artifacts = artifacts @@ -1728,30 +2159,30 @@ def __init__( class PipelineRunResponse(msrest.serialization.Model): """The response properties returned for a pipeline run. - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: + :ivar status: The current status of the pipeline run. + :vartype status: str + :ivar imported_artifacts: The artifacts imported in the pipeline run. + :vartype imported_artifacts: list[str] + :ivar progress: The current progress of the copy operation. + :vartype progress: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProgressProperties + :ivar start_time: The time the pipeline run started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the pipeline run finished. + :vartype finish_time: ~datetime.datetime + :ivar source: The source of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: + :ivar target: The target of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str + :ivar trigger: The trigger that caused the pipeline run. + :vartype trigger: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case + :ivar pipeline_run_error_message: The detailed error message for the pipeline run in the case of failure. - :type pipeline_run_error_message: str + :vartype pipeline_run_error_message: str """ _attribute_map = { @@ -1782,6 +2213,33 @@ def __init__( pipeline_run_error_message: Optional[str] = None, **kwargs ): + """ + :keyword status: The current status of the pipeline run. + :paramtype status: str + :keyword imported_artifacts: The artifacts imported in the pipeline run. + :paramtype imported_artifacts: list[str] + :keyword progress: The current progress of the copy operation. + :paramtype progress: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProgressProperties + :keyword start_time: The time the pipeline run started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the pipeline run finished. + :paramtype finish_time: ~datetime.datetime + :keyword source: The source of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineSourceProperties + :keyword target: The target of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + :keyword trigger: The trigger that caused the pipeline run. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineTriggerDescriptor + :keyword pipeline_run_error_message: The detailed error message for the pipeline run in the + case of failure. + :paramtype pipeline_run_error_message: str + """ super(PipelineRunResponse, self).__init__(**kwargs) self.status = status self.imported_artifacts = imported_artifacts @@ -1798,12 +2256,12 @@ def __init__( class PipelineRunSourceProperties(msrest.serialization.Model): """PipelineRunSourceProperties. - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the source. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str + :ivar name: The name of the source. + :vartype name: str """ _attribute_map = { @@ -1818,6 +2276,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the source. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunSourceType + :keyword name: The name of the source. + :paramtype name: str + """ super(PipelineRunSourceProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1826,12 +2292,12 @@ def __init__( class PipelineRunTargetProperties(msrest.serialization.Model): """PipelineRunTargetProperties. - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the target. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str + :ivar name: The name of the target. + :vartype name: str """ _attribute_map = { @@ -1846,6 +2312,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the target. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunTargetType + :keyword name: The name of the target. + :paramtype name: str + """ super(PipelineRunTargetProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1854,8 +2328,8 @@ def __init__( class PipelineSourceTriggerDescriptor(msrest.serialization.Model): """PipelineSourceTriggerDescriptor. - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime + :ivar timestamp: The timestamp when the source update happened. + :vartype timestamp: ~datetime.datetime """ _attribute_map = { @@ -1868,6 +2342,10 @@ def __init__( timestamp: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword timestamp: The timestamp when the source update happened. + :paramtype timestamp: ~datetime.datetime + """ super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) self.timestamp = timestamp @@ -1877,9 +2355,9 @@ class PipelineSourceTriggerProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The current status of the source trigger. Possible values include: + :ivar status: Required. The current status of the source trigger. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TriggerStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TriggerStatus """ _validation = { @@ -1896,6 +2374,12 @@ def __init__( status: Union[str, "TriggerStatus"] = "Enabled", **kwargs ): + """ + :keyword status: Required. The current status of the source trigger. Possible values include: + "Enabled", "Disabled". Default value: "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TriggerStatus + """ super(PipelineSourceTriggerProperties, self).__init__(**kwargs) self.status = status @@ -1903,8 +2387,8 @@ def __init__( class PipelineTriggerDescriptor(msrest.serialization.Model): """PipelineTriggerDescriptor. - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: + :ivar source_trigger: The source trigger that caused the pipeline run. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceTriggerDescriptor """ @@ -1918,6 +2402,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerDescriptor"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger that caused the pipeline run. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceTriggerDescriptor + """ super(PipelineTriggerDescriptor, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1925,8 +2414,8 @@ def __init__( class PipelineTriggerProperties(msrest.serialization.Model): """PipelineTriggerProperties. - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: + :ivar source_trigger: The source trigger properties of the pipeline. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceTriggerProperties """ @@ -1940,6 +2429,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerProperties"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger properties of the pipeline. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineSourceTriggerProperties + """ super(PipelineTriggerProperties, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1947,13 +2441,13 @@ def __init__( class Policies(msrest.serialization.Model): """The policies for a container registry. - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: + :ivar quarantine_policy: The quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: + :ivar trust_policy: The content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicy + :ivar retention_policy: The retention policy for a container registry. + :vartype retention_policy: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RetentionPolicy """ @@ -1971,6 +2465,16 @@ def __init__( retention_policy: Optional["RetentionPolicy"] = None, **kwargs ): + """ + :keyword quarantine_policy: The quarantine policy for a container registry. + :paramtype quarantine_policy: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.QuarantinePolicy + :keyword trust_policy: The content trust policy for a container registry. + :paramtype trust_policy: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicy + :keyword retention_policy: The retention policy for a container registry. + :paramtype retention_policy: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RetentionPolicy + """ super(Policies, self).__init__(**kwargs) self.quarantine_policy = quarantine_policy self.trust_policy = trust_policy @@ -1980,8 +2484,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """The Private Endpoint resource. - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str + :ivar id: This is private endpoint resource created with Microsoft.Network resource provider. + :vartype id: str """ _attribute_map = { @@ -1994,6 +2498,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: This is private endpoint resource created with Microsoft.Network resource + provider. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -2011,12 +2520,12 @@ class PrivateEndpointConnection(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of private endpoint connection resource. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -2049,6 +2558,15 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -2058,13 +2576,13 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """The result of a request to list private endpoint connections for a container registry. - :param value: The list of private endpoint connections. Since this list may be incomplete, the + :ivar value: The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - :type value: + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint + :ivar next_link: The URI that can be used to request the next list of private endpoint connections. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2079,6 +2597,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private endpoint connections. Since this list may be incomplete, + the nextLink field should be used to request the next list of private endpoint connections. + :paramtype value: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] + :keyword next_link: The URI that can be used to request the next list of private endpoint + connections. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2091,16 +2618,16 @@ class PrivateLinkResource(msrest.serialization.Model): :ivar type: The resource type is private link resource. :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -2126,6 +2653,18 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword id: The resource ID. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.type = None self.id = id @@ -2138,11 +2677,12 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """The result of a request to list private link resources for a container registry. - :param value: The list of private link resources. Since this list may be incomplete, the + :ivar value: The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str + :vartype value: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResource] + :ivar next_link: The URI that can be used to request the next list of private link resources. + :vartype next_link: str """ _attribute_map = { @@ -2157,6 +2697,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :paramtype value: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResource] + :keyword next_link: The URI that can be used to request the next list of private link + resources. + :paramtype next_link: str + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2165,15 +2714,16 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :param status: The private link service connection status. Possible values include: "Approved", + :ivar status: The private link service connection status. Possible values include: "Approved", "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectionStatus + :ivar description: The description for connection status. For example if connection is rejected + it can indicate reason for rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or + :vartype actions_required: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ActionsRequired """ @@ -2191,6 +2741,19 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: The private link service connection status. Possible values include: + "Approved", "Pending", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectionStatus + :keyword description: The description for connection status. For example if connection is + rejected it can indicate reason for rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :paramtype actions_required: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ActionsRequired + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -2200,8 +2763,8 @@ def __init__( class ProgressProperties(msrest.serialization.Model): """ProgressProperties. - :param percentage: The percentage complete of the copy operation. - :type percentage: str + :ivar percentage: The percentage complete of the copy operation. + :vartype percentage: str """ _attribute_map = { @@ -2214,6 +2777,10 @@ def __init__( percentage: Optional[str] = None, **kwargs ): + """ + :keyword percentage: The percentage complete of the copy operation. + :paramtype percentage: str + """ super(ProgressProperties, self).__init__(**kwargs) self.percentage = percentage @@ -2221,9 +2788,9 @@ def __init__( class QuarantinePolicy(msrest.serialization.Model): """The quarantine policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus """ _attribute_map = { @@ -2236,6 +2803,11 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus + """ super(QuarantinePolicy, self).__init__(**kwargs) self.status = status @@ -2245,9 +2817,9 @@ class RegenerateCredentialParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName """ _validation = { @@ -2264,6 +2836,11 @@ def __init__( name: Union[str, "PasswordName"], **kwargs ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName + """ super(RegenerateCredentialParameters, self).__init__(**kwargs) self.name = name @@ -2281,11 +2858,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData """ @@ -2314,6 +2891,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -2336,17 +2920,17 @@ class Registry(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties :ivar login_server: The URL that can be used to log into the container registry. :vartype login_server: str :ivar creation_date: The creation date of the container registry in ISO8601 format. @@ -2358,16 +2942,18 @@ class Registry(Resource): ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState :ivar status: The status of the container registry at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool :ivar data_endpoint_host_names: List of host names that will serve data when dataEndpointEnabled is true. :vartype data_endpoint_host_names: list[str] @@ -2375,20 +2961,20 @@ class Registry(Resource): registry. :vartype private_endpoint_connections: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleBypassOptions - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ZoneRedundancy - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool """ _validation = { @@ -2450,6 +3036,44 @@ def __init__( anonymous_pull_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleBypassOptions + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container + registry. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ZoneRedundancy + :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :paramtype anonymous_pull_enabled: bool + """ super(Registry, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity @@ -2473,10 +3097,10 @@ def __init__( class RegistryListCredentialsResult(msrest.serialization.Model): """The response from the ListCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryPassword] """ @@ -2492,6 +3116,13 @@ def __init__( passwords: Optional[List["RegistryPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryPassword] + """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -2500,11 +3131,11 @@ def __init__( class RegistryListResult(msrest.serialization.Model): """The result of a request to list container registries. - :param value: The list of container registries. Since this list may be incomplete, the nextLink + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str """ _attribute_map = { @@ -2519,6 +3150,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ super(RegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2531,8 +3169,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the container registry. - :type name: str + :ivar name: Required. The name of the container registry. + :vartype name: str :ivar type: The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". @@ -2557,6 +3195,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ super(RegistryNameCheckRequest, self).__init__(**kwargs) self.name = name @@ -2564,13 +3206,13 @@ def __init__( class RegistryNameStatus(msrest.serialization.Model): """The result of a request to check the availability of a container registry name. - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str """ _attribute_map = { @@ -2587,6 +3229,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ super(RegistryNameStatus, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2596,10 +3247,10 @@ def __init__( class RegistryPassword(msrest.serialization.Model): """The login password for the container registry. - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName - :param value: The password value. - :type value: str + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName + :ivar value: The password value. + :vartype value: str """ _attribute_map = { @@ -2614,6 +3265,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ super(RegistryPassword, self).__init__(**kwargs) self.name = name self.value = value @@ -2622,32 +3279,34 @@ def __init__( class RegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a container registry. - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleBypassOptions - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool """ _attribute_map = { @@ -2680,6 +3339,37 @@ def __init__( anonymous_pull_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.IdentityProperties + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.NetworkRuleBypassOptions + :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :paramtype anonymous_pull_enabled: bool + """ super(RegistryUpdateParameters, self).__init__(**kwargs) self.identity = identity self.tags = tags @@ -2697,14 +3387,15 @@ def __init__( class RegistryUsage(msrest.serialization.Model): """The quota usage for a container registry. - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsageUnit + :ivar name: The name of the usage. + :vartype name: str + :ivar limit: The limit of the usage. + :vartype limit: long + :ivar current_value: The current value of the usage. + :vartype current_value: long + :ivar unit: The unit of measurement. Possible values include: "Count", "Bytes". + :vartype unit: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsageUnit """ _attribute_map = { @@ -2723,6 +3414,17 @@ def __init__( unit: Optional[Union[str, "RegistryUsageUnit"]] = None, **kwargs ): + """ + :keyword name: The name of the usage. + :paramtype name: str + :keyword limit: The limit of the usage. + :paramtype limit: long + :keyword current_value: The current value of the usage. + :paramtype current_value: long + :keyword unit: The unit of measurement. Possible values include: "Count", "Bytes". + :paramtype unit: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsageUnit + """ super(RegistryUsage, self).__init__(**kwargs) self.name = name self.limit = limit @@ -2733,8 +3435,8 @@ def __init__( class RegistryUsageListResult(msrest.serialization.Model): """The result of a request to get container registry quota usages. - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsage] + :ivar value: The list of container registry quota usages. + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsage] """ _attribute_map = { @@ -2747,6 +3449,10 @@ def __init__( value: Optional[List["RegistryUsage"]] = None, **kwargs ): + """ + :keyword value: The list of container registry quota usages. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUsage] + """ super(RegistryUsageListResult, self).__init__(**kwargs) self.value = value @@ -2764,11 +3470,11 @@ class Replication(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData :ivar provisioning_state: The provisioning state of the replication at the time the operation @@ -2778,13 +3484,13 @@ class Replication(Resource): ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState :ivar status: The status of the replication at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry + :vartype region_endpoint_enabled: bool + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry replication. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ZoneRedundancy """ @@ -2820,6 +3526,21 @@ def __init__( zone_redundancy: Optional[Union[str, "ZoneRedundancy"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container registry + replication. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ZoneRedundancy + """ super(Replication, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.status = None @@ -2830,11 +3551,11 @@ def __init__( class ReplicationListResult(msrest.serialization.Model): """The result of a request to list replications for a container registry. - :param value: The list of replications. Since this list may be incomplete, the nextLink field + :ivar value: The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] + :ivar next_link: The URI that can be used to request the next list of replications. + :vartype next_link: str """ _attribute_map = { @@ -2849,6 +3570,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] + :keyword next_link: The URI that can be used to request the next list of replications. + :paramtype next_link: str + """ super(ReplicationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2857,12 +3585,12 @@ def __init__( class ReplicationUpdateParameters(msrest.serialization.Model): """The parameters for updating a replication. - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar tags: A set of tags. The tags for the replication. + :vartype tags: dict[str, str] + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool + :vartype region_endpoint_enabled: bool """ _attribute_map = { @@ -2877,6 +3605,14 @@ def __init__( region_endpoint_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the replication. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + """ super(ReplicationUpdateParameters, self).__init__(**kwargs) self.tags = tags self.region_endpoint_enabled = region_endpoint_enabled @@ -2885,18 +3621,18 @@ def __init__( class Request(msrest.serialization.Model): """The request that generated the event. - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str """ _attribute_map = { @@ -2917,6 +3653,20 @@ def __init__( useragent: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the request that initiated the event. + :paramtype id: str + :keyword addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :paramtype addr: str + :keyword host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :paramtype host: str + :keyword method: The request method that generated the event. + :paramtype method: str + :keyword useragent: The user agent header of the request. + :paramtype useragent: str + """ super(Request, self).__init__(**kwargs) self.id = id self.addr = addr @@ -2930,13 +3680,13 @@ class RetentionPolicy(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int + :ivar days: The number of days to retain an untagged manifest after which it gets purged. + :vartype days: int :ivar last_updated_time: The timestamp when the policy was last updated. :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus """ _validation = { @@ -2956,6 +3706,13 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword days: The number of days to retain an untagged manifest after which it gets purged. + :paramtype days: int + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus + """ super(RetentionPolicy, self).__init__(**kwargs) self.days = days self.last_updated_time = None @@ -2975,8 +3732,8 @@ class ScopeMap(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str + :ivar description: The user friendly description of the scope map. + :vartype description: str :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. :vartype type_properties_type: str :ivar creation_date: The creation date of scope map. @@ -2985,10 +3742,10 @@ class ScopeMap(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. + :ivar actions: The list of scoped permissions for registry artifacts. E.g. repositories/repository-name/content/read, repositories/repository-name/metadata/write. - :type actions: list[str] + :vartype actions: list[str] """ _validation = { @@ -3020,6 +3777,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. + :paramtype actions: list[str] + """ super(ScopeMap, self).__init__(**kwargs) self.description = description self.type_properties_type = None @@ -3031,11 +3796,11 @@ def __init__( class ScopeMapListResult(msrest.serialization.Model): """The result of a request to list scope maps for a container registry. - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field + :ivar value: The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] + :ivar next_link: The URI that can be used to request the next list of scope maps. + :vartype next_link: str """ _attribute_map = { @@ -3050,6 +3815,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of scope maps. Since this list may be incomplete, the nextLink field + should be used to request the next list of scope maps. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] + :keyword next_link: The URI that can be used to request the next list of scope maps. + :paramtype next_link: str + """ super(ScopeMapListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3058,12 +3830,12 @@ def __init__( class ScopeMapUpdateParameters(msrest.serialization.Model): """The properties for updating the scope map. - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. + :ivar description: The user friendly description of the scope map. + :vartype description: str + :ivar actions: The list of scope permissions for registry artifacts. E.g. repositories/repository-name/pull, repositories/repository-name/delete. - :type actions: list[str] + :vartype actions: list[str] """ _attribute_map = { @@ -3078,6 +3850,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scope permissions for registry artifacts. + E.g. repositories/repository-name/pull, + repositories/repository-name/delete. + :paramtype actions: list[str] + """ super(ScopeMapUpdateParameters, self).__init__(**kwargs) self.description = description self.actions = actions @@ -3090,9 +3870,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name of the container registry. Required for registry creation. + :ivar name: Required. The SKU name of the container registry. Required for registry creation. Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SkuName :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", "Standard", "Premium". :vartype tier: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SkuTier @@ -3114,6 +3894,11 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Possible values include: "Classic", "Basic", "Standard", "Premium". + :paramtype name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -3122,11 +3907,11 @@ def __init__( class Source(msrest.serialization.Model): """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :param addr: The IP or hostname and the port of the registry node that generated the event. + :ivar addr: The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str """ _attribute_map = { @@ -3141,6 +3926,13 @@ def __init__( instance_id: Optional[str] = None, **kwargs ): + """ + :keyword addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :paramtype addr: str + :keyword instance_id: The running instance of an application. Changes after each restart. + :paramtype instance_id: str + """ super(Source, self).__init__(**kwargs) self.addr = addr self.instance_id = instance_id @@ -3175,6 +3967,8 @@ def __init__( self, **kwargs ): + """ + """ super(Status, self).__init__(**kwargs) self.display_status = None self.message = None @@ -3218,6 +4012,8 @@ def __init__( self, **kwargs ): + """ + """ super(StatusDetailProperties, self).__init__(**kwargs) self.type = None self.code = None @@ -3233,19 +4029,18 @@ class SyncProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param token_id: Required. The resource ID of the ACR token used to authenticate the connected + :ivar token_id: Required. The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. - :type token_id: str - :param schedule: The cron expression indicating the schedule that the connected registry will + :vartype token_id: str + :ivar schedule: The cron expression indicating the schedule that the connected registry will sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. + :vartype schedule: str + :ivar sync_window: The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: Required. The period of time for which a message is available to sync - before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per - ISO8601. - :type message_ttl: ~datetime.timedelta + :vartype sync_window: ~datetime.timedelta + :ivar message_ttl: Required. The period of time for which a message is available to sync before + it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :vartype message_ttl: ~datetime.timedelta :ivar last_sync_time: The last time a sync occurred between the connected registry and its parent. :vartype last_sync_time: ~datetime.datetime @@ -3279,6 +4074,21 @@ def __init__( sync_window: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword token_id: Required. The resource ID of the ACR token used to authenticate the + connected registry to its parent during sync. + :paramtype token_id: str + :keyword schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :paramtype schedule: str + :keyword sync_window: The time window during which sync is enabled for each schedule + occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype sync_window: ~datetime.timedelta + :keyword message_ttl: Required. The period of time for which a message is available to sync + before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per + ISO8601. + :paramtype message_ttl: ~datetime.timedelta + """ super(SyncProperties, self).__init__(**kwargs) self.token_id = token_id self.schedule = schedule @@ -3291,15 +4101,15 @@ def __init__( class SyncUpdateProperties(msrest.serialization.Model): """The parameters for updating the sync properties of the connected registry with its parent. - :param schedule: The cron expression indicating the schedule that the connected registry will + :ivar schedule: The cron expression indicating the schedule that the connected registry will sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. + :vartype schedule: str + :ivar sync_window: The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: The period of time for which a message is available to sync before it is + :vartype sync_window: ~datetime.timedelta + :ivar message_ttl: The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type message_ttl: ~datetime.timedelta + :vartype message_ttl: ~datetime.timedelta """ _attribute_map = { @@ -3316,6 +4126,17 @@ def __init__( message_ttl: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :paramtype schedule: str + :keyword sync_window: The time window during which sync is enabled for each schedule + occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype sync_window: ~datetime.timedelta + :keyword message_ttl: The period of time for which a message is available to sync before it is + expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype message_ttl: ~datetime.timedelta + """ super(SyncUpdateProperties, self).__init__(**kwargs) self.schedule = schedule self.sync_window = sync_window @@ -3325,22 +4146,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :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: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3363,6 +4184,24 @@ def __init__( 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". + :paramtype created_by_type: str or + ~azure.mgmt.containerregistry.v2020_11_01_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". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3375,24 +4214,24 @@ def __init__( class Target(msrest.serialization.Model): """The target of the event. - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: long + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: long + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str """ _attribute_map = { @@ -3421,6 +4260,27 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword media_type: The MIME type of the referenced object. + :paramtype media_type: str + :keyword size: The number of bytes of the content. Same as Length field. + :paramtype size: long + :keyword digest: The digest of the content, as defined by the Registry V2 HTTP API + Specification. + :paramtype digest: str + :keyword length: The number of bytes of the content. Same as Size field. + :paramtype length: long + :keyword repository: The repository name. + :paramtype repository: str + :keyword url: The direct URL to the content. + :paramtype url: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword name: The name of the artifact. + :paramtype name: str + :keyword version: The version of the artifact. + :paramtype version: str + """ super(Target, self).__init__(**kwargs) self.media_type = media_type self.size = size @@ -3458,6 +4318,8 @@ def __init__( self, **kwargs ): + """ + """ super(TlsCertificateProperties, self).__init__(**kwargs) self.type = None self.location = None @@ -3490,6 +4352,8 @@ def __init__( self, **kwargs ): + """ + """ super(TlsProperties, self).__init__(**kwargs) self.status = None self.certificate = None @@ -3514,15 +4378,15 @@ class Token(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype scope_map_id: str + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus """ _validation = { @@ -3554,6 +4418,17 @@ def __init__( status: Optional[Union[str, "TokenStatus"]] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCredentialsProperties + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus + """ super(Token, self).__init__(**kwargs) self.creation_date = None self.provisioning_state = None @@ -3565,16 +4440,16 @@ def __init__( class TokenCertificate(msrest.serialization.Model): """The properties of a certificate used for authenticating a token. - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or + :ivar name: Possible values include: "certificate1", "certificate2". + :vartype name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format + :ivar expiry: The expiry datetime of the certificate. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The thumbprint of the certificate. + :vartype thumbprint: str + :ivar encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - :type encoded_pem_certificate: str + :vartype encoded_pem_certificate: str """ _attribute_map = { @@ -3593,6 +4468,18 @@ def __init__( encoded_pem_certificate: Optional[str] = None, **kwargs ): + """ + :keyword name: Possible values include: "certificate1", "certificate2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCertificateName + :keyword expiry: The expiry datetime of the certificate. + :paramtype expiry: ~datetime.datetime + :keyword thumbprint: The thumbprint of the certificate. + :paramtype thumbprint: str + :keyword encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM + format that will be used for authenticating the token. + :paramtype encoded_pem_certificate: str + """ super(TokenCertificate, self).__init__(**kwargs) self.name = name self.expiry = expiry @@ -3603,11 +4490,12 @@ def __init__( class TokenCredentialsProperties(msrest.serialization.Model): """The properties of the credentials that can be used for authenticating the token. - :param certificates: - :type certificates: + :ivar certificates: + :vartype certificates: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] + :ivar passwords: + :vartype passwords: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] """ _attribute_map = { @@ -3622,6 +4510,14 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword certificates: + :paramtype certificates: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCertificate] + :keyword passwords: + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPassword] + """ super(TokenCredentialsProperties, self).__init__(**kwargs) self.certificates = certificates self.passwords = passwords @@ -3630,11 +4526,11 @@ def __init__( class TokenListResult(msrest.serialization.Model): """The result of a request to list tokens for a container registry. - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should + :ivar value: The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] + :ivar next_link: The URI that can be used to request the next list of tokens. + :vartype next_link: str """ _attribute_map = { @@ -3649,6 +4545,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of tokens. Since this list may be incomplete, the nextLink field + should be used to request the next list of tokens. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] + :keyword next_link: The URI that can be used to request the next list of tokens. + :paramtype next_link: str + """ super(TokenListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3659,13 +4562,14 @@ class TokenPassword(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName + :ivar creation_time: The creation datetime of the password. + :vartype creation_time: ~datetime.datetime + :ivar expiry: The expiry datetime of the password. + :vartype expiry: ~datetime.datetime + :ivar name: The password name "password1" or "password2". Possible values include: "password1", + "password2". + :vartype name: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName :ivar value: The password value. :vartype value: str """ @@ -3689,6 +4593,16 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword creation_time: The creation datetime of the password. + :paramtype creation_time: ~datetime.datetime + :keyword expiry: The expiry datetime of the password. + :paramtype expiry: ~datetime.datetime + :keyword name: The password name "password1" or "password2". Possible values include: + "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenPasswordName + """ super(TokenPassword, self).__init__(**kwargs) self.creation_time = creation_time self.expiry = expiry @@ -3699,14 +4613,14 @@ def __init__( class TokenUpdateParameters(msrest.serialization.Model): """The parameters for updating a token. - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: + :vartype scope_map_id: str + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCredentialsProperties """ @@ -3724,6 +4638,17 @@ def __init__( credentials: Optional["TokenCredentialsProperties"] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenStatus + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenCredentialsProperties + """ super(TokenUpdateParameters, self).__init__(**kwargs) self.scope_map_id = scope_map_id self.status = status @@ -3733,12 +4658,12 @@ def __init__( class TrustPolicy(msrest.serialization.Model): """The content trust policy for a container registry. - :param type: The type of trust policy. Possible values include: "Notary". Default value: + :ivar type: The type of trust policy. Possible values include: "Notary". Default value: "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values + :vartype type: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus """ _attribute_map = { @@ -3753,6 +4678,15 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TrustPolicyType + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PolicyStatus + """ super(TrustPolicy, self).__init__(**kwargs) self.type = type self.status = status @@ -3761,10 +4695,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -3779,6 +4713,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id @@ -3789,11 +4729,11 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar action: The action of virtual network rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str + :vartype virtual_network_resource_id: str """ _validation = { @@ -3812,6 +4752,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of virtual network rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Action + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.action = action self.virtual_network_resource_id = virtual_network_resource_id @@ -3830,22 +4777,22 @@ class Webhook(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] :ivar provisioning_state: The provisioning state of the webhook at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -3886,6 +4833,24 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] + """ super(Webhook, self).__init__(location=location, tags=tags, **kwargs) self.status = status self.scope = scope @@ -3898,24 +4863,24 @@ class WebhookCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the webhook. This cannot be changed after the resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] """ @@ -3945,6 +4910,28 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] + """ super(WebhookCreateParameters, self).__init__(**kwargs) self.tags = tags self.location = location @@ -3958,11 +4945,11 @@ def __init__( class WebhookListResult(msrest.serialization.Model): """The result of a request to list webhooks for a container registry. - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str + :ivar value: The list of webhooks. Since this list may be incomplete, the nextLink field should + be used to request the next list of webhooks. + :vartype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] + :ivar next_link: The URI that can be used to request the next list of webhooks. + :vartype next_link: str """ _attribute_map = { @@ -3977,6 +4964,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :paramtype value: list[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] + :keyword next_link: The URI that can be used to request the next list of webhooks. + :paramtype next_link: str + """ super(WebhookListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3985,21 +4979,21 @@ def __init__( class WebhookUpdateParameters(msrest.serialization.Model): """The parameters for updating a webhook. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] """ @@ -4023,6 +5017,25 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookAction] + """ super(WebhookUpdateParameters, self).__init__(**kwargs) self.tags = tags self.service_uri = service_uri diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_connected_registries_operations.py index 4a7d3d35924b..a257a6c3920e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_connected_registries_operations.py @@ -5,25 +5,270 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deactivate_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ConnectedRegistriesOperations(object): """ConnectedRegistriesOperations operations. @@ -47,14 +292,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> "_models.ConnectedRegistry": """Gets the properties of the connected registry. :param resource_group_name: The name of the resource group to which the container registry @@ -74,34 +319,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -110,56 +345,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_create_parameters, # type: "_models.ConnectedRegistry" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> "_models.ConnectedRegistry": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -171,17 +396,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_create_parameters, # type: "_models.ConnectedRegistry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConnectedRegistry"] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> LROPoller["_models.ConnectedRegistry"]: """Creates a connected registry for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -192,18 +419,24 @@ def begin_create( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,28 +449,21 @@ def begin_create( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_create_parameters=connected_registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -249,64 +475,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a connected registry from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -318,15 +534,17 @@ def begin_delete( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +559,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,56 +578,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> "_models.ConnectedRegistry": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -429,17 +628,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConnectedRegistry"] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.ConnectedRegistry"]: """Updates a connected registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -450,18 +651,24 @@ def begin_update( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryUpdateParameters + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,28 +681,21 @@ def begin_update( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_update_parameters=connected_registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -507,16 +707,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ConnectedRegistryListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ConnectedRegistryListResult"]: """Lists all connected registries for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -529,8 +730,10 @@ def list( connectedRegistry parent), mode, and connectionState. The supported operator is eq. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryListResult] + :return: An iterator like instance of either ConnectedRegistryListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ConnectedRegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] @@ -538,38 +741,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + deserialized = self._deserialize("ConnectedRegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,12 +782,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -595,60 +796,49 @@ def get_next(next_link=None): def _deactivate_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + @distributed_trace def begin_deactivate( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deactivates the connected registry instance. :param resource_group_name: The name of the resource group to which the container registry @@ -660,15 +850,17 @@ def begin_deactivate( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -683,22 +875,14 @@ def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -710,4 +894,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_export_pipelines_operations.py index 989ed33885d4..c44798049855 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_export_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExportPipelinesOperations(object): """ExportPipelinesOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> "_models.ExportPipeline": """Gets the properties of the export pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> "_models.ExportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExportPipeline"] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ExportPipeline"]: """Creates an export pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an export pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ExportPipelineListResult"]: """Lists all export pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_import_pipelines_operations.py index b2bcf0b079a2..411738835f69 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_import_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImportPipelinesOperations(object): """ImportPipelinesOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> "_models.ImportPipeline": """Gets the properties of the import pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> "_models.ImportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ImportPipeline"] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ImportPipeline"]: """Creates an import pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an import pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ImportPipelineListResult"]: """Lists all import pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_operations.py index 15e33990115f..111b71d0ff65 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Container Registry REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_pipeline_runs_operations.py index e5c2460baced..61f21f12f0ce 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_pipeline_runs_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PipelineRunsOperations(object): """PipelineRunsOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> "_models.PipelineRun": """Gets the detailed information for a given pipeline run. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> "_models.PipelineRun": cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PipelineRun"] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> LROPoller["_models.PipelineRun"]: """Creates a pipeline run for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a pipeline run from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PipelineRunListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PipelineRunListResult"]: """Lists all the pipeline runs for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_private_endpoint_connections_operations.py index a4401f75ce56..392fa60cd1f2 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Update the state of specified private endpoint connection associated with the container registry. @@ -191,18 +326,24 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,28 +356,21 @@ def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,41 +382,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + 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', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -295,14 +421,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -314,15 +441,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -337,22 +466,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,15 +485,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all private endpoint connections in a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -381,8 +503,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -390,36 +514,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -437,6 +558,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_registries_operations.py index b3a36fc3566f..280d5db92447 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_registries_operations.py @@ -5,25 +5,519 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_import_image_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_credentials_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -49,41 +543,32 @@ def __init__(self, client, config, serializer, deserializer): def _import_image_initial( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,14 +581,15 @@ def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace def begin_import_image( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> LROPoller[None]: """Copies an image to this container registry from the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -113,18 +599,22 @@ def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -136,24 +626,18 @@ def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -165,20 +649,22 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace def check_name_availability( self, - registry_name_check_request, # type: "_models.RegistryNameCheckRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryNameStatus" + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": """Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryNameStatus @@ -189,30 +675,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,15 +702,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": """Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -252,27 +730,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,47 +754,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry, 'Registry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -344,16 +803,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -365,15 +826,19 @@ def begin_create( :type registry: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,27 +850,21 @@ def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -417,39 +876,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -462,13 +913,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -478,15 +930,17 @@ def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -500,21 +954,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -526,47 +973,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -584,16 +1021,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -602,18 +1041,23 @@ def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -625,27 +1069,21 @@ def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,14 +1095,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry @@ -672,7 +1111,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -680,35 +1120,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -726,21 +1162,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -748,34 +1186,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,18 +1226,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -822,27 +1256,17 @@ def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -856,16 +1280,18 @@ def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace def regenerate_credential( self, - resource_group_name, # type: str - registry_name, # type: str - regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -875,7 +1301,8 @@ def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.RegistryListCredentialsResult @@ -886,32 +1313,22 @@ def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -925,15 +1342,17 @@ def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace def list_usages( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryUsageListResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": """Gets the quota usages for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -951,27 +1370,17 @@ def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,15 +1394,17 @@ def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """Lists the private link resources for a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1002,8 +1413,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -1011,36 +1424,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1058,6 +1468,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1065,43 +1476,32 @@ def get_next(next_link=None): def _generate_credentials_initial( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> Optional["_models.GenerateCredentialsResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateCredentialsResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1117,16 +1517,18 @@ def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace def begin_generate_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> LROPoller["_models.GenerateCredentialsResult"]: """Generate keys for a token of a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1135,18 +1537,24 @@ def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1158,27 +1566,21 @@ def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1190,4 +1592,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_replications_operations.py index 30efb60c5b2f..2d54f6e038d8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_replications_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReplicationsOperations(object): """ReplicationsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": """Gets the properties of the specified replication. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Creates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,20 @@ def begin_create( :type replication: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a replication from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Updates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,24 @@ def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +632,21 @@ def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +658,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationListResult"]: """Lists all the replications for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -518,8 +676,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -527,36 +687,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +731,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_scope_maps_operations.py index 2ebcd74ba198..bd8f83de3218 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_scope_maps_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ScopeMapsOperations(object): """ScopeMapsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> "_models.ScopeMap": """Gets the properties of the specified scope map. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Creates a scope map for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +371,23 @@ def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a scope map from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Updates a scope map with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,23 @@ def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +631,21 @@ def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +657,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScopeMapListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ScopeMapListResult"]: """Lists all the scope maps for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +676,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -527,36 +685,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_tokens_operations.py index 1eed748bf063..a08e255ce368 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_tokens_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TokensOperations(object): """TokensOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> "_models.Token": """Gets the properties of the specified token. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_create_parameters, 'Token') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Creates a token for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,19 @@ def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +399,21 @@ def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +425,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +464,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a token from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +484,17 @@ def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +509,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +528,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +578,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Updates a token with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +601,23 @@ def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +630,21 @@ def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +656,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TokenListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TokenListResult"]: """Lists all the tokens for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +675,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -527,36 +684,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +728,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_webhooks_operations.py index 0a20215ff4dc..f9be5d323dc9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/operations/_webhooks_operations.py @@ -5,25 +5,334 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_ping_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_callback_config_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_events_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebhooksOperations(object): """WebhooksOperations operations. @@ -47,14 +356,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": """Gets the properties of the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +383,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +408,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +459,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Creates a webhook for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +482,23 @@ def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +511,21 @@ def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +537,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +576,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a webhook from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +596,17 @@ def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +621,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +640,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +690,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Updates a webhook with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +713,23 @@ def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2020_11_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +742,21 @@ def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +768,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebhookListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.WebhookListResult"]: """Lists all the webhooks for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +787,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -527,36 +796,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,19 +840,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace def ping( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventInfo" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": """Triggers a ping event to be sent to the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +873,18 @@ def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +898,18 @@ def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace def get_callback_config( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CallbackConfig" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": """Gets the configuration of service URI and custom headers for the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -670,28 +929,18 @@ def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -705,16 +954,18 @@ def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventListResult"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> Iterable["_models.EventListResult"]: """Lists recent events for the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -726,7 +977,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2020_11_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -734,37 +986,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -782,6 +1032,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py index 1c7a837c89aa..cd03e01ec1aa 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py index df060a3fffb2..35732fcde4f7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py @@ -6,124 +6,117 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations, ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, ScopeMapsOperations, TokensOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ConnectedRegistriesOperations -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import WebhooksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar connected_registries: ConnectedRegistriesOperations operations - :vartype connected_registries: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ConnectedRegistriesOperations + :vartype connected_registries: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.ConnectedRegistriesOperations :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2021_06_01_preview.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2021_06_01_preview.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2021_06_01_preview.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2021_06_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.ReplicationsOperations :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations :vartype tokens: azure.mgmt.containerregistry.v2021_06_01_preview.operations.TokensOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2021_06_01_preview.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2021_06_01_preview.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.connected_registries = ConnectedRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.connected_registries = ConnectedRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json index 1f9ede71d80a..28d65d512c22 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "connected_registries": "ConnectedRegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py index 8b9eecbd9a13..32ee9fc2a46c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py index 3d582531459d..9683655e4b99 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py @@ -6,120 +6,118 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations, ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, ScopeMapsOperations, TokensOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ConnectedRegistriesOperations -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import WebhooksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar connected_registries: ConnectedRegistriesOperations operations - :vartype connected_registries: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ConnectedRegistriesOperations + :vartype connected_registries: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ConnectedRegistriesOperations :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ReplicationsOperations :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations - :vartype tokens: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.TokensOperations + :vartype tokens: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.TokensOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.connected_registries = ConnectedRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + - self.connected_registries = ConnectedRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py index fdb8fe92c394..df21e7b95da1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._connected_registries_operations import build_create_request_initial, build_deactivate_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,34 +75,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -105,8 +101,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -120,40 +118,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -165,8 +152,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -185,18 +175,24 @@ async def begin_create( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,28 +205,21 @@ async def begin_create( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_create_parameters=connected_registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -242,6 +231,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore async def _delete_initial( @@ -256,41 +246,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -309,15 +290,17 @@ async def begin_delete( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +315,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,6 +334,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore async def _update_initial( @@ -374,40 +350,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -419,8 +384,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,18 +407,24 @@ async def begin_update( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryUpdateParameters + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,28 +437,21 @@ async def begin_update( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_update_parameters=connected_registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -496,8 +463,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -517,8 +486,10 @@ def list( connectedRegistry parent), mode, and connectionState. The supported operator is eq. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryListResult] + :return: An iterator like instance of either ConnectedRegistryListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] @@ -526,38 +497,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + deserialized = self._deserialize("ConnectedRegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,12 +538,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -593,41 +562,32 @@ async def _deactivate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + @distributed_trace_async async def begin_deactivate( self, resource_group_name: str, @@ -646,15 +606,17 @@ async def begin_deactivate( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -669,22 +631,14 @@ async def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -696,4 +650,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py index 52d0b94e30fb..0e586e4f0b99 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._export_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py index 140018bb95fc..1cc533b0aa6f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._import_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py index e413be47e4db..47a3ee97cb2b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py index 5338e562b9a8..415ae1a96734 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._pipeline_runs_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,8 +333,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -370,8 +351,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -379,36 +362,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -426,6 +406,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py index 0d70575ec9bc..15f8b30af7a0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -184,18 +175,24 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -208,28 +205,21 @@ async def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,6 +231,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -255,26 +246,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,6 +270,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -305,15 +290,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -328,22 +315,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,8 +334,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -371,8 +352,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -380,36 +363,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -427,6 +407,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py index 8f3f9a3ba7f5..afd3423b2d07 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_generate_credentials_request_initial, build_get_request, build_import_image_request_initial, build_list_by_resource_group_request, build_list_credentials_request, build_list_private_link_resources_request, build_list_request, build_list_usages_request, build_regenerate_credential_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,30 +60,22 @@ async def _import_image_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImportImageParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -91,6 +88,8 @@ async def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace_async async def begin_import_image( self, resource_group_name: str, @@ -107,18 +106,22 @@ async def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -130,24 +133,18 @@ async def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -159,8 +156,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace_async async def check_name_availability( self, registry_name_check_request: "_models.RegistryNameCheckRequest", @@ -171,7 +170,8 @@ async def check_name_availability( :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameStatus @@ -182,30 +182,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,8 +209,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -244,27 +237,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,8 +261,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -292,32 +277,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -335,8 +310,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -355,15 +333,20 @@ async def begin_create( :type registry: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -375,27 +358,21 @@ async def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,6 +384,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _delete_initial( @@ -420,25 +398,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -451,6 +421,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -466,15 +438,17 @@ async def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -488,21 +462,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,6 +481,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _update_initial( @@ -528,32 +496,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -571,8 +529,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -588,18 +549,24 @@ async def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -611,27 +578,21 @@ async def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -643,8 +604,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -657,7 +620,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -665,35 +629,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -711,11 +671,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -724,7 +686,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -732,34 +695,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -777,11 +735,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace_async async def list_credentials( self, resource_group_name: str, @@ -805,27 +765,17 @@ async def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,8 +789,11 @@ async def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace_async async def regenerate_credential( self, resource_group_name: str, @@ -857,7 +810,8 @@ async def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListCredentialsResult @@ -868,32 +822,22 @@ async def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -907,8 +851,11 @@ async def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace_async async def list_usages( self, resource_group_name: str, @@ -932,27 +879,17 @@ async def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -966,8 +903,11 @@ async def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, resource_group_name: str, @@ -982,8 +922,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -991,36 +933,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1038,6 +977,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1055,32 +995,22 @@ async def _generate_credentials_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') + + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,8 +1026,11 @@ async def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace_async async def begin_generate_credentials( self, resource_group_name: str, @@ -1113,18 +1046,24 @@ async def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1136,27 +1075,21 @@ async def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1168,4 +1101,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py index c0b22cc762d2..037865cc421f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._replications_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,20 @@ async def begin_create( :type replication: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +203,21 @@ async def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +229,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _delete_initial( @@ -254,26 +244,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +268,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +288,17 @@ async def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +313,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +332,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _update_initial( @@ -369,33 +348,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +382,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +405,24 @@ async def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +435,21 @@ async def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -506,8 +479,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py index 7930e49900ab..05a81c594b15 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._scope_maps_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +534,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py index 93ed4121fab6..2febe1baa3f8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tokens_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_create_parameters, 'Token') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +177,19 @@ async def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +202,21 @@ async def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +228,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _delete_initial( @@ -254,26 +243,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +267,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +287,17 @@ async def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +312,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +331,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _update_initial( @@ -369,33 +347,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +381,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +404,23 @@ async def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +433,21 @@ async def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +459,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +478,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -515,36 +487,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,6 +531,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py index 15b231f7705e..d3027177865a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._webhooks_operations import build_create_request_initial, build_delete_request_initial, build_get_callback_config_request, build_get_request, build_list_events_request, build_list_request, build_ping_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,33 +117,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -183,18 +174,24 @@ async def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +204,21 @@ async def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +230,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _delete_initial( @@ -254,26 +245,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +269,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -304,15 +289,17 @@ async def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,22 +314,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _update_initial( @@ -369,33 +349,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -413,8 +383,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -433,18 +406,24 @@ async def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -457,28 +436,21 @@ async def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,8 +462,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -507,7 +481,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -515,36 +490,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,11 +534,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace_async async def ping( self, resource_group_name: str, @@ -593,28 +567,18 @@ async def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +592,11 @@ async def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace_async async def get_callback_config( self, resource_group_name: str, @@ -656,28 +623,18 @@ async def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -691,8 +648,11 @@ async def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, resource_group_name: str, @@ -711,7 +671,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -719,37 +680,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -767,6 +726,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py index 1a70164b9beb..51c980de1cff 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py @@ -6,216 +6,111 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActivationProperties - from ._models_py3 import ActiveDirectoryObject - from ._models_py3 import Actor - from ._models_py3 import CallbackConfig - from ._models_py3 import ConnectedRegistry - from ._models_py3 import ConnectedRegistryListResult - from ._models_py3 import ConnectedRegistryUpdateParameters - from ._models_py3 import EncryptionProperty - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import Event - from ._models_py3 import EventContent - from ._models_py3 import EventInfo - from ._models_py3 import EventListResult - from ._models_py3 import EventRequestMessage - from ._models_py3 import EventResponseMessage - from ._models_py3 import ExportPipeline - from ._models_py3 import ExportPipelineListResult - from ._models_py3 import ExportPipelineTargetProperties - from ._models_py3 import ExportPolicy - from ._models_py3 import GenerateCredentialsParameters - from ._models_py3 import GenerateCredentialsResult - from ._models_py3 import IPRule - from ._models_py3 import IdentityProperties - from ._models_py3 import ImportImageParameters - from ._models_py3 import ImportPipeline - from ._models_py3 import ImportPipelineListResult - from ._models_py3 import ImportPipelineSourceProperties - from ._models_py3 import ImportSource - from ._models_py3 import ImportSourceCredentials - from ._models_py3 import InnerErrorDescription - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LoggingProperties - from ._models_py3 import LoginServerProperties - from ._models_py3 import NetworkRuleSet - from ._models_py3 import OperationDefinition - from ._models_py3 import OperationDisplayDefinition - from ._models_py3 import OperationListResult - from ._models_py3 import OperationLogSpecificationDefinition - from ._models_py3 import OperationMetricSpecificationDefinition - from ._models_py3 import OperationServiceSpecificationDefinition - from ._models_py3 import ParentProperties - from ._models_py3 import PipelineRun - from ._models_py3 import PipelineRunListResult - from ._models_py3 import PipelineRunRequest - from ._models_py3 import PipelineRunResponse - from ._models_py3 import PipelineRunSourceProperties - from ._models_py3 import PipelineRunTargetProperties - from ._models_py3 import PipelineSourceTriggerDescriptor - from ._models_py3 import PipelineSourceTriggerProperties - from ._models_py3 import PipelineTriggerDescriptor - from ._models_py3 import PipelineTriggerProperties - from ._models_py3 import Policies - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProgressProperties - from ._models_py3 import ProxyResource - from ._models_py3 import QuarantinePolicy - from ._models_py3 import RegenerateCredentialParameters - from ._models_py3 import Registry - from ._models_py3 import RegistryListCredentialsResult - from ._models_py3 import RegistryListResult - from ._models_py3 import RegistryNameCheckRequest - from ._models_py3 import RegistryNameStatus - from ._models_py3 import RegistryPassword - from ._models_py3 import RegistryUpdateParameters - from ._models_py3 import RegistryUsage - from ._models_py3 import RegistryUsageListResult - from ._models_py3 import Replication - from ._models_py3 import ReplicationListResult - from ._models_py3 import ReplicationUpdateParameters - from ._models_py3 import Request - from ._models_py3 import Resource - from ._models_py3 import RetentionPolicy - from ._models_py3 import ScopeMap - from ._models_py3 import ScopeMapListResult - from ._models_py3 import ScopeMapUpdateParameters - from ._models_py3 import Sku - from ._models_py3 import Source - from ._models_py3 import Status - from ._models_py3 import StatusDetailProperties - from ._models_py3 import SyncProperties - from ._models_py3 import SyncUpdateProperties - from ._models_py3 import SystemData - from ._models_py3 import Target - from ._models_py3 import TlsCertificateProperties - from ._models_py3 import TlsProperties - from ._models_py3 import Token - from ._models_py3 import TokenCertificate - from ._models_py3 import TokenCredentialsProperties - from ._models_py3 import TokenListResult - from ._models_py3 import TokenPassword - from ._models_py3 import TokenUpdateParameters - from ._models_py3 import TrustPolicy - from ._models_py3 import UserIdentityProperties - from ._models_py3 import VirtualNetworkRule - from ._models_py3 import Webhook - from ._models_py3 import WebhookCreateParameters - from ._models_py3 import WebhookListResult - from ._models_py3 import WebhookUpdateParameters -except (SyntaxError, ImportError): - from ._models import ActivationProperties # type: ignore - from ._models import ActiveDirectoryObject # type: ignore - from ._models import Actor # type: ignore - from ._models import CallbackConfig # type: ignore - from ._models import ConnectedRegistry # type: ignore - from ._models import ConnectedRegistryListResult # type: ignore - from ._models import ConnectedRegistryUpdateParameters # type: ignore - from ._models import EncryptionProperty # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import Event # type: ignore - from ._models import EventContent # type: ignore - from ._models import EventInfo # type: ignore - from ._models import EventListResult # type: ignore - from ._models import EventRequestMessage # type: ignore - from ._models import EventResponseMessage # type: ignore - from ._models import ExportPipeline # type: ignore - from ._models import ExportPipelineListResult # type: ignore - from ._models import ExportPipelineTargetProperties # type: ignore - from ._models import ExportPolicy # type: ignore - from ._models import GenerateCredentialsParameters # type: ignore - from ._models import GenerateCredentialsResult # type: ignore - from ._models import IPRule # type: ignore - from ._models import IdentityProperties # type: ignore - from ._models import ImportImageParameters # type: ignore - from ._models import ImportPipeline # type: ignore - from ._models import ImportPipelineListResult # type: ignore - from ._models import ImportPipelineSourceProperties # type: ignore - from ._models import ImportSource # type: ignore - from ._models import ImportSourceCredentials # type: ignore - from ._models import InnerErrorDescription # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LoggingProperties # type: ignore - from ._models import LoginServerProperties # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import OperationDefinition # type: ignore - from ._models import OperationDisplayDefinition # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationLogSpecificationDefinition # type: ignore - from ._models import OperationMetricSpecificationDefinition # type: ignore - from ._models import OperationServiceSpecificationDefinition # type: ignore - from ._models import ParentProperties # type: ignore - from ._models import PipelineRun # type: ignore - from ._models import PipelineRunListResult # type: ignore - from ._models import PipelineRunRequest # type: ignore - from ._models import PipelineRunResponse # type: ignore - from ._models import PipelineRunSourceProperties # type: ignore - from ._models import PipelineRunTargetProperties # type: ignore - from ._models import PipelineSourceTriggerDescriptor # type: ignore - from ._models import PipelineSourceTriggerProperties # type: ignore - from ._models import PipelineTriggerDescriptor # type: ignore - from ._models import PipelineTriggerProperties # type: ignore - from ._models import Policies # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProgressProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QuarantinePolicy # type: ignore - from ._models import RegenerateCredentialParameters # type: ignore - from ._models import Registry # type: ignore - from ._models import RegistryListCredentialsResult # type: ignore - from ._models import RegistryListResult # type: ignore - from ._models import RegistryNameCheckRequest # type: ignore - from ._models import RegistryNameStatus # type: ignore - from ._models import RegistryPassword # type: ignore - from ._models import RegistryUpdateParameters # type: ignore - from ._models import RegistryUsage # type: ignore - from ._models import RegistryUsageListResult # type: ignore - from ._models import Replication # type: ignore - from ._models import ReplicationListResult # type: ignore - from ._models import ReplicationUpdateParameters # type: ignore - from ._models import Request # type: ignore - from ._models import Resource # type: ignore - from ._models import RetentionPolicy # type: ignore - from ._models import ScopeMap # type: ignore - from ._models import ScopeMapListResult # type: ignore - from ._models import ScopeMapUpdateParameters # type: ignore - from ._models import Sku # type: ignore - from ._models import Source # type: ignore - from ._models import Status # type: ignore - from ._models import StatusDetailProperties # type: ignore - from ._models import SyncProperties # type: ignore - from ._models import SyncUpdateProperties # type: ignore - from ._models import SystemData # type: ignore - from ._models import Target # type: ignore - from ._models import TlsCertificateProperties # type: ignore - from ._models import TlsProperties # type: ignore - from ._models import Token # type: ignore - from ._models import TokenCertificate # type: ignore - from ._models import TokenCredentialsProperties # type: ignore - from ._models import TokenListResult # type: ignore - from ._models import TokenPassword # type: ignore - from ._models import TokenUpdateParameters # type: ignore - from ._models import TrustPolicy # type: ignore - from ._models import UserIdentityProperties # type: ignore - from ._models import VirtualNetworkRule # type: ignore - from ._models import Webhook # type: ignore - from ._models import WebhookCreateParameters # type: ignore - from ._models import WebhookListResult # type: ignore - from ._models import WebhookUpdateParameters # type: ignore +from ._models_py3 import ActivationProperties +from ._models_py3 import ActiveDirectoryObject +from ._models_py3 import Actor +from ._models_py3 import CallbackConfig +from ._models_py3 import ConnectedRegistry +from ._models_py3 import ConnectedRegistryListResult +from ._models_py3 import ConnectedRegistryUpdateParameters +from ._models_py3 import EncryptionProperty +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import Event +from ._models_py3 import EventContent +from ._models_py3 import EventInfo +from ._models_py3 import EventListResult +from ._models_py3 import EventRequestMessage +from ._models_py3 import EventResponseMessage +from ._models_py3 import ExportPipeline +from ._models_py3 import ExportPipelineListResult +from ._models_py3 import ExportPipelineTargetProperties +from ._models_py3 import ExportPolicy +from ._models_py3 import GenerateCredentialsParameters +from ._models_py3 import GenerateCredentialsResult +from ._models_py3 import IPRule +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportImageParameters +from ._models_py3 import ImportPipeline +from ._models_py3 import ImportPipelineListResult +from ._models_py3 import ImportPipelineSourceProperties +from ._models_py3 import ImportSource +from ._models_py3 import ImportSourceCredentials +from ._models_py3 import InnerErrorDescription +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LoggingProperties +from ._models_py3 import LoginServerProperties +from ._models_py3 import NetworkRuleSet +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import OperationLogSpecificationDefinition +from ._models_py3 import OperationMetricSpecificationDefinition +from ._models_py3 import OperationServiceSpecificationDefinition +from ._models_py3 import ParentProperties +from ._models_py3 import PipelineRun +from ._models_py3 import PipelineRunListResult +from ._models_py3 import PipelineRunRequest +from ._models_py3 import PipelineRunResponse +from ._models_py3 import PipelineRunSourceProperties +from ._models_py3 import PipelineRunTargetProperties +from ._models_py3 import PipelineSourceTriggerDescriptor +from ._models_py3 import PipelineSourceTriggerProperties +from ._models_py3 import PipelineTriggerDescriptor +from ._models_py3 import PipelineTriggerProperties +from ._models_py3 import Policies +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProgressProperties +from ._models_py3 import ProxyResource +from ._models_py3 import QuarantinePolicy +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import RegistryUsage +from ._models_py3 import RegistryUsageListResult +from ._models_py3 import Replication +from ._models_py3 import ReplicationListResult +from ._models_py3 import ReplicationUpdateParameters +from ._models_py3 import Request +from ._models_py3 import Resource +from ._models_py3 import RetentionPolicy +from ._models_py3 import ScopeMap +from ._models_py3 import ScopeMapListResult +from ._models_py3 import ScopeMapUpdateParameters +from ._models_py3 import Sku +from ._models_py3 import Source +from ._models_py3 import Status +from ._models_py3 import StatusDetailProperties +from ._models_py3 import SyncProperties +from ._models_py3 import SyncUpdateProperties +from ._models_py3 import SystemData +from ._models_py3 import Target +from ._models_py3 import TlsCertificateProperties +from ._models_py3 import TlsProperties +from ._models_py3 import Token +from ._models_py3 import TokenCertificate +from ._models_py3 import TokenCredentialsProperties +from ._models_py3 import TokenListResult +from ._models_py3 import TokenPassword +from ._models_py3 import TokenUpdateParameters +from ._models_py3 import TrustPolicy +from ._models_py3 import UserIdentityProperties +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import Webhook +from ._models_py3 import WebhookCreateParameters +from ._models_py3 import WebhookListResult +from ._models_py3 import WebhookUpdateParameters + from ._container_registry_management_client_enums import ( Action, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py index 029513edcb95..783d26c6cacf 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py @@ -6,67 +6,52 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Action(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action of virtual network rule. """ ALLOW = "Allow" -class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" RECREATE = "Recreate" -class ActivationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActivationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The activation status of the connected registry. """ ACTIVE = "Active" INACTIVE = "Inactive" -class AuditLogStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuditLogStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether audit logs are enabled on the connected registry. """ ENABLED = "Enabled" DISABLED = "Disabled" -class CertificateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of certificate location. """ LOCAL_DIRECTORY = "LocalDirectory" -class ConnectedRegistryMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectedRegistryMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The mode of the connected registry resource that indicates the permissions of the registry. """ REGISTRY = "Registry" MIRROR = "Mirror" -class ConnectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current connection state of the connected registry. """ @@ -75,7 +60,7 @@ class ConnectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYNCING = "Syncing" UNHEALTHY = "Unhealthy" -class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private link service connection status. """ @@ -84,7 +69,7 @@ class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -93,28 +78,28 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class EncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether or not the encryption is enabled for container registry. """ ENABLED = "enabled" DISABLED = "disabled" -class ExportPolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExportPolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImportMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. """ @@ -122,7 +107,7 @@ class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NO_FORCE = "NoForce" FORCE = "Force" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -131,7 +116,7 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The verbosity of logs persisted on the connected registry. """ @@ -141,53 +126,53 @@ class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" NONE = "None" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to allow trusted Azure services to access a network restricted registry. """ AZURE_SERVICES = "AzureServices" NONE = "None" -class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name. """ PASSWORD = "password" PASSWORD2 = "password2" -class PipelineOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OVERWRITE_TAGS = "OverwriteTags" OVERWRITE_BLOBS = "OverwriteBlobs" DELETE_SOURCE_BLOB_ON_SUCCESS = "DeleteSourceBlobOnSuccess" CONTINUE_ON_ERRORS = "ContinueOnErrors" -class PipelineRunSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the source. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineRunTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunTargetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the target. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source for the import pipeline. """ AZURE_STORAGE_BLOB_CONTAINER = "AzureStorageBlobContainer" -class PolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the resource. """ @@ -198,21 +183,21 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not public network access is allowed for the container registry. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RegistryUsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegistryUsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement. """ COUNT = "Count" BYTES = "Bytes" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -221,7 +206,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name of the container registry. Required for registry creation. """ @@ -230,7 +215,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier based on the SKU name. """ @@ -239,46 +224,46 @@ class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TlsStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TlsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether HTTPS is enabled for the login server. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TokenCertificateName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenCertificateName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CERTIFICATE1 = "certificate1" CERTIFICATE2 = "certificate2" -class TokenPasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenPasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name "password1" or "password2" """ PASSWORD1 = "password1" PASSWORD2 = "password2" -class TokenStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the token example enabled or disabled. """ ENABLED = "enabled" DISABLED = "disabled" -class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the source trigger. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TrustPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrustPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of trust policy. """ NOTARY = "Notary" -class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PUSH = "push" DELETE = "delete" @@ -286,14 +271,14 @@ class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CHART_PUSH = "chart_push" CHART_DELETE = "chart_delete" -class WebhookStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the webhook at the time the operation was called. """ ENABLED = "enabled" DISABLED = "disabled" -class ZoneRedundancy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ZoneRedundancy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not zone redundancy is enabled for this container registry """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py deleted file mode 100644 index 5c8f58e3fc47..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py +++ /dev/null @@ -1,3666 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ActivationProperties(msrest.serialization.Model): - """The activation properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The activation status of the connected registry. Possible values include: - "Active", "Inactive". - :vartype status: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActivationStatus - """ - - _validation = { - 'status': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActivationProperties, self).__init__(**kwargs) - self.status = None - - -class ActiveDirectoryObject(msrest.serialization.Model): - """The Active Directory Object that will be used for authenticating the token of a container registry. - - :param object_id: The user/group/application object ID for Active Directory Object that will be - used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that - will be used for authenticating the token of a container registry. - :type tenant_id: str - """ - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryObject, self).__init__(**kwargs) - self.object_id = kwargs.get('object_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - - -class Actor(msrest.serialization.Model): - """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - - :param name: The subject or username associated with the request context that generated the - event. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Actor, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class CallbackConfig(msrest.serialization.Model): - """The configuration of service URI and custom headers for the webhook. - - All required parameters must be populated in order to send to Azure. - - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - """ - - _validation = { - 'service_uri': {'required': True}, - } - - _attribute_map = { - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(CallbackConfig, self).__init__(**kwargs) - self.service_uri = kwargs['service_uri'] - self.custom_headers = kwargs.get('custom_headers', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ConnectedRegistry(ProxyResource): - """An object that represents a connected registry for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param mode: The mode of the connected registry resource that indicates the permissions of the - registry. Possible values include: "Registry", "Mirror". - :type mode: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryMode - :ivar version: The current version of ACR runtime on the connected registry. - :vartype version: str - :ivar connection_state: The current connection state of the connected registry. Possible values - include: "Online", "Offline", "Syncing", "Unhealthy". - :vartype connection_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionState - :ivar last_activity_time: The last activity time of the connected registry. - :vartype last_activity_time: ~datetime.datetime - :ivar activation: The activation properties of the connected registry. - :vartype activation: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActivationProperties - :param parent: The parent of the connected registry. - :type parent: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ParentProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :type client_token_ids: list[str] - :param login_server: The login server properties of the connected registry. - :type login_server: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoginServerProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties - :ivar status_details: The list of current statuses of the connected registry. - :vartype status_details: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.StatusDetailProperties] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'connection_state': {'readonly': True}, - 'last_activity_time': {'readonly': True}, - 'activation': {'readonly': True}, - 'status_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'connection_state': {'key': 'properties.connectionState', 'type': 'str'}, - 'last_activity_time': {'key': 'properties.lastActivityTime', 'type': 'iso-8601'}, - 'activation': {'key': 'properties.activation', 'type': 'ActivationProperties'}, - 'parent': {'key': 'properties.parent', 'type': 'ParentProperties'}, - 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'LoginServerProperties'}, - 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, - 'status_details': {'key': 'properties.statusDetails', 'type': '[StatusDetailProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistry, self).__init__(**kwargs) - self.provisioning_state = None - self.mode = kwargs.get('mode', None) - self.version = None - self.connection_state = None - self.last_activity_time = None - self.activation = None - self.parent = kwargs.get('parent', None) - self.client_token_ids = kwargs.get('client_token_ids', None) - self.login_server = kwargs.get('login_server', None) - self.logging = kwargs.get('logging', None) - self.status_details = None - - -class ConnectedRegistryListResult(msrest.serialization.Model): - """The result of a request to list connected registries for a container registry. - - :param value: The list of connected registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of connected registries. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] - :param next_link: The URI that can be used to request the next list of connected registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ConnectedRegistry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ConnectedRegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a connected registry. - - :param sync_properties: The sync properties of the connected registry with its parent. - :type sync_properties: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncUpdateProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :type client_token_ids: list[str] - """ - - _attribute_map = { - 'sync_properties': {'key': 'properties.syncProperties', 'type': 'SyncUpdateProperties'}, - 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, - 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) - self.sync_properties = kwargs.get('sync_properties', None) - self.logging = kwargs.get('logging', None) - self.client_token_ids = kwargs.get('client_token_ids', None) - - -class EncryptionProperty(msrest.serialization.Model): - """EncryptionProperty. - - :param status: Indicates whether or not the encryption is enabled for container registry. - Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.KeyVaultProperties - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProperty, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this - contract. - :type details: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.InnerErrorDescription - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class EventInfo(msrest.serialization.Model): - """The basic information of an event. - - :param id: The event ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventInfo, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Event(EventInfo): - """The event for a webhook. - - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventResponseMessage - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, - 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.event_request_message = kwargs.get('event_request_message', None) - self.event_response_message = kwargs.get('event_response_message', None) - - -class EventContent(msrest.serialization.Model): - """The content of the event request message. - - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the - authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor - initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Source - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'action': {'key': 'action', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'Target'}, - 'request': {'key': 'request', 'type': 'Request'}, - 'actor': {'key': 'actor', 'type': 'Actor'}, - 'source': {'key': 'source', 'type': 'Source'}, - } - - def __init__( - self, - **kwargs - ): - super(EventContent, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.action = kwargs.get('action', None) - self.target = kwargs.get('target', None) - self.request = kwargs.get('request', None) - self.actor = kwargs.get('actor', None) - self.source = kwargs.get('source', None) - - -class EventListResult(msrest.serialization.Model): - """The result of a request to list events for a webhook. - - :param value: The list of events. Since this list may be incomplete, the nextLink field should - be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventRequestMessage(msrest.serialization.Model): - """The event request message sent to the service URI. - - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'EventContent'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'method': {'key': 'method', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventRequestMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.method = kwargs.get('method', None) - self.request_uri = kwargs.get('request_uri', None) - self.version = kwargs.get('version', None) - - -class EventResponseMessage(msrest.serialization.Model): - """The event response message received from the service URI. - - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventResponseMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.reason_phrase = kwargs.get('reason_phrase', None) - self.status_code = kwargs.get('status_code', None) - self.version = kwargs.get('version', None) - - -class ExportPipeline(ProxyResource): - """An object that represents an export pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'target': {'key': 'properties.target', 'type': 'ExportPipelineTargetProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.target = kwargs.get('target', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ExportPipelineListResult(msrest.serialization.Model): - """The result of a request to list export pipelines for a container registry. - - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExportPipelineTargetProperties(msrest.serialization.Model): - """The properties of the export pipeline target. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class ExportPolicy(msrest.serialization.Model): - """The export policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". Default value: "enabled". - :type status: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', "enabled") - - -class GenerateCredentialsParameters(msrest.serialization.Model): - """The parameters used to generate credentials for a specified token or user of a container registry. - - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become - invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or - password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName - """ - - _attribute_map = { - 'token_id': {'key': 'tokenId', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsParameters, self).__init__(**kwargs) - self.token_id = kwargs.get('token_id', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - - -class GenerateCredentialsResult(msrest.serialization.Model): - """The response from the GenerateCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class IdentityProperties(msrest.serialization.Model): - """Managed identity for the resource. - - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", "None". - :type type: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity - dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.UserIdentityProperties] - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImportImageParameters(msrest.serialization.Model): - """ImportImageParameters. - - All required parameters must be populated in order to send to Azure. - - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will - be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only - copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any - existing target tags will fail the operation before any copying begins. Possible values - include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportMode - """ - - _validation = { - 'source': {'required': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'ImportSource'}, - 'target_tags': {'key': 'targetTags', 'type': '[str]'}, - 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportImageParameters, self).__init__(**kwargs) - self.source = kwargs['source'] - self.target_tags = kwargs.get('target_tags', None) - self.untagged_target_repositories = kwargs.get('untagged_target_repositories', None) - self.mode = kwargs.get('mode', "NoForce") - - -class ImportPipeline(ProxyResource): - """An object that represents an import pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'source': {'key': 'properties.source', 'type': 'ImportPipelineSourceProperties'}, - 'trigger': {'key': 'properties.trigger', 'type': 'PipelineTriggerProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.source = kwargs.get('source', None) - self.trigger = kwargs.get('trigger', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ImportPipelineListResult(msrest.serialization.Model): - """The result of a request to list import pipelines for a container registry. - - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ImportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ImportPipelineSourceProperties(msrest.serialization.Model): - """The properties of the import pipeline source. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of source for the import pipeline. Possible values include: - "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlobContainer") - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class ImportSource(msrest.serialization.Model): - """ImportSource. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str - """ - - _validation = { - 'source_image': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'registry_uri': {'key': 'registryUri', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, - 'source_image': {'key': 'sourceImage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSource, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.registry_uri = kwargs.get('registry_uri', None) - self.credentials = kwargs.get('credentials', None) - self.source_image = kwargs['source_image'] - - -class ImportSourceCredentials(msrest.serialization.Model): - """ImportSourceCredentials. - - All required parameters must be populated in order to send to Azure. - - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str - """ - - _validation = { - 'password': {'required': True}, - } - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSourceCredentials, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs['password'] - - -class InnerErrorDescription(msrest.serialization.Model): - """inner error. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InnerErrorDescription, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.ip_address_or_range = kwargs['ip_address_or_range'] - - -class KeyVaultProperties(msrest.serialization.Model): - """KeyVaultProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str - :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of - the key that is actually used for encryption. - :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str - :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. - :vartype key_rotation_enabled: bool - :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'versioned_key_identifier': {'readonly': True}, - 'key_rotation_enabled': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'versioned_key_identifier': {'key': 'versionedKeyIdentifier', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'str'}, - 'key_rotation_enabled': {'key': 'keyRotationEnabled', 'type': 'bool'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_identifier = kwargs.get('key_identifier', None) - self.versioned_key_identifier = None - self.identity = kwargs.get('identity', None) - self.key_rotation_enabled = None - self.last_key_rotation_timestamp = None - - -class LoggingProperties(msrest.serialization.Model): - """The logging properties of the connected registry. - - :param log_level: The verbosity of logs persisted on the connected registry. Possible values - include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". - :type log_level: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LogLevel - :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. - Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type audit_log_status: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.AuditLogStatus - """ - - _attribute_map = { - 'log_level': {'key': 'logLevel', 'type': 'str'}, - 'audit_log_status': {'key': 'auditLogStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoggingProperties, self).__init__(**kwargs) - self.log_level = kwargs.get('log_level', "Information") - self.audit_log_status = kwargs.get('audit_log_status', "Disabled") - - -class LoginServerProperties(msrest.serialization.Model): - """The login server properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar host: The host of the connected registry. Can be FQDN or IP. - :vartype host: str - :ivar tls: The TLS properties of the connected registry login server. - :vartype tls: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsProperties - """ - - _validation = { - 'host': {'readonly': True}, - 'tls': {'readonly': True}, - } - - _attribute_map = { - 'host': {'key': 'host', 'type': 'str'}, - 'tls': {'key': 'tls', 'type': 'TlsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(LoginServerProperties, self).__init__(**kwargs) - self.host = None - self.tls = None - - -class NetworkRuleSet(msrest.serialization.Model): - """The network rule set for a container registry. - - All required parameters must be populated in order to send to Azure. - - :param default_action: Required. The default action of allow or deny when no other rules match. - Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.IPRule] - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', "Allow") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - - -class OperationDefinition(msrest.serialization.Model): - """The definition of a container registry operation. - - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDisplayDefinition - :param is_data_action: This property indicates if the operation is an action or a data action - ref: - https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. - :type is_data_action: bool - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationServiceSpecificationDefinition - """ - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDefinition, self).__init__(**kwargs) - self.origin = kwargs.get('origin', None) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplayDefinition(msrest.serialization.Model): - """The display information for a container registry operation. - - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The result of a request to list container registry operations. - - :param value: The list of container registry operations. Since this list may be incomplete, the - nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry - operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationLogSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring log. - - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationLogSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class OperationMetricSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring metric. - - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class OperationServiceSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring list. - - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationLogSpecificationDefinition] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, - 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecificationDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - self.log_specifications = kwargs.get('log_specifications', None) - - -class ParentProperties(msrest.serialization.Model): - """The properties of the connected registry parent. - - All required parameters must be populated in order to send to Azure. - - :param id: The resource ID of the parent to which the connected registry will be associated. - :type id: str - :param sync_properties: Required. The sync properties of the connected registry with its - parent. - :type sync_properties: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncProperties - """ - - _validation = { - 'sync_properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'sync_properties': {'key': 'syncProperties', 'type': 'SyncProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ParentProperties, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.sync_properties = kwargs['sync_properties'] - - -class PipelineRun(ProxyResource): - """An object that represents a pipeline run for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of a pipeline run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunRequest - :ivar response: The response of a pipeline run. - :vartype response: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline - run configuration has not changed. - :type force_update_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'request': {'key': 'properties.request', 'type': 'PipelineRunRequest'}, - 'response': {'key': 'properties.response', 'type': 'PipelineRunResponse'}, - 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRun, self).__init__(**kwargs) - self.provisioning_state = None - self.request = kwargs.get('request', None) - self.response = None - self.force_update_tag = kwargs.get('force_update_tag', None) - - -class PipelineRunListResult(msrest.serialization.Model): - """The result of a request to list pipeline runs for a container registry. - - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field - should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PipelineRun]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PipelineRunRequest(msrest.serialization.Model): - """The request properties provided for a pipeline run. - - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - """ - - _attribute_map = { - 'pipeline_resource_id': {'key': 'pipelineResourceId', 'type': 'str'}, - 'artifacts': {'key': 'artifacts', 'type': '[str]'}, - 'source': {'key': 'source', 'type': 'PipelineRunSourceProperties'}, - 'target': {'key': 'target', 'type': 'PipelineRunTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunRequest, self).__init__(**kwargs) - self.pipeline_resource_id = kwargs.get('pipeline_resource_id', None) - self.artifacts = kwargs.get('artifacts', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - - -class PipelineRunResponse(msrest.serialization.Model): - """The response properties returned for a pipeline run. - - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case - of failure. - :type pipeline_run_error_message: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'imported_artifacts': {'key': 'importedArtifacts', 'type': '[str]'}, - 'progress': {'key': 'progress', 'type': 'ProgressProperties'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'source': {'key': 'source', 'type': 'ImportPipelineSourceProperties'}, - 'target': {'key': 'target', 'type': 'ExportPipelineTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - 'trigger': {'key': 'trigger', 'type': 'PipelineTriggerDescriptor'}, - 'pipeline_run_error_message': {'key': 'pipelineRunErrorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunResponse, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.imported_artifacts = kwargs.get('imported_artifacts', None) - self.progress = kwargs.get('progress', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - self.trigger = kwargs.get('trigger', None) - self.pipeline_run_error_message = kwargs.get('pipeline_run_error_message', None) - - -class PipelineRunSourceProperties(msrest.serialization.Model): - """PipelineRunSourceProperties. - - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineRunTargetProperties(msrest.serialization.Model): - """PipelineRunTargetProperties. - - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineSourceTriggerDescriptor(msrest.serialization.Model): - """PipelineSourceTriggerDescriptor. - - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime - """ - - _attribute_map = { - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) - self.timestamp = kwargs.get('timestamp', None) - - -class PipelineSourceTriggerProperties(msrest.serialization.Model): - """PipelineSourceTriggerProperties. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The current status of the source trigger. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TriggerStatus - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerProperties, self).__init__(**kwargs) - self.status = kwargs.get('status', "Enabled") - - -class PipelineTriggerDescriptor(msrest.serialization.Model): - """PipelineTriggerDescriptor. - - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerDescriptor - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerDescriptor'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerDescriptor, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class PipelineTriggerProperties(msrest.serialization.Model): - """PipelineTriggerProperties. - - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerProperties - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerProperties, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class Policies(msrest.serialization.Model): - """The policies for a container registry. - - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RetentionPolicy - :param export_policy: The export policy for a container registry. - :type export_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicy - """ - - _attribute_map = { - 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, - 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - 'export_policy': {'key': 'exportPolicy', 'type': 'ExportPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(Policies, self).__init__(**kwargs) - self.quarantine_policy = kwargs.get('quarantine_policy', None) - self.trust_policy = kwargs.get('trust_policy', None) - self.retention_policy = kwargs.get('retention_policy', None) - self.export_policy = kwargs.get('export_policy', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateEndpointConnection(ProxyResource): - """An object that represents a private endpoint connection for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of private endpoint connection resource. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """The result of a request to list private endpoint connections for a container registry. - - :param value: The list of private endpoint connections. Since this list may be incomplete, the - nextLink field should be used to request the next list of private endpoint connections. - :type value: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint - connections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(msrest.serialization.Model): - """A resource that supports private link capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The resource type is private link resource. - :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'type': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.type = None - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.group_id = kwargs.get('group_id', None) - self.required_members = kwargs.get('required_members', None) - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """The result of a request to list private link resources for a container registry. - - :param value: The list of private link resources. Since this list may be incomplete, the - nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The state of a private link service connection. - - :param status: The private link service connection status. Possible values include: "Approved", - "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ProgressProperties(msrest.serialization.Model): - """ProgressProperties. - - :param percentage: The percentage complete of the copy operation. - :type percentage: str - """ - - _attribute_map = { - 'percentage': {'key': 'percentage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProgressProperties, self).__init__(**kwargs) - self.percentage = kwargs.get('percentage', None) - - -class QuarantinePolicy(msrest.serialization.Model): - """The quarantine policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuarantinePolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - - -class RegenerateCredentialParameters(msrest.serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateCredentialParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.system_data = None - - -class Registry(Resource): - """An object that represents a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties - :ivar login_server: The URL that can be used to log into the container registry. - :vartype login_server: str - :ivar creation_date: The creation date of the container registry in ISO8601 format. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the container registry at the time the - operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", - "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :ivar status: The status of the container registry at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :ivar data_endpoint_host_names: List of host names that will serve data when - dataEndpointEnabled is true. - :vartype data_endpoint_host_names: list[str] - :ivar private_endpoint_connections: List of private endpoint connections for a container - registry. - :vartype private_endpoint_connections: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. - Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'sku': {'required': True}, - 'login_server': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'data_endpoint_host_names': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'data_endpoint_host_names': {'key': 'properties.dataEndpointHostNames', 'type': '[str]'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, - 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Registry, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.identity = kwargs.get('identity', None) - self.login_server = None - self.creation_date = None - self.provisioning_state = None - self.status = None - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.data_endpoint_host_names = None - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - self.zone_redundancy = kwargs.get('zone_redundancy', None) - self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', False) - - -class RegistryListCredentialsResult(msrest.serialization.Model): - """The response from the ListCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class RegistryListResult(msrest.serialization.Model): - """The result of a request to list container registries. - - :param value: The list of container registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Registry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegistryNameCheckRequest(msrest.serialization.Model): - """A request to check whether a container registry name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the container registry. - :type name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Has constant value: - "Microsoft.ContainerRegistry/registries". - :vartype type: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - **kwargs - ): - super(RegistryNameCheckRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class RegistryNameStatus(msrest.serialization.Model): - """The result of a request to check the availability of a container registry name. - - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryNameStatus, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class RegistryPassword(msrest.serialization.Model): - """The login password for the container registry. - - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName - :param value: The password value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPassword, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class RegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a container registry. - - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUpdateParameters, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.admin_user_enabled = kwargs.get('admin_user_enabled', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', None) - - -class RegistryUsage(msrest.serialization.Model): - """The quota usage for a container registry. - - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageUnit - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsage, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.limit = kwargs.get('limit', None) - self.current_value = kwargs.get('current_value', None) - self.unit = kwargs.get('unit', None) - - -class RegistryUsageListResult(msrest.serialization.Model): - """The result of a request to get container registry quota usages. - - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RegistryUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Replication(Resource): - """An object that represents a replication for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of the replication at the time the operation - was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :ivar status: The status of the replication at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry - replication. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Replication, self).__init__(**kwargs) - self.provisioning_state = None - self.status = None - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', True) - self.zone_redundancy = kwargs.get('zone_redundancy', None) - - -class ReplicationListResult(msrest.serialization.Model): - """The result of a request to list replications for a container registry. - - :param value: The list of replications. Since this list may be incomplete, the nextLink field - should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Replication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationUpdateParameters(msrest.serialization.Model): - """The parameters for updating a replication. - - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', None) - - -class Request(msrest.serialization.Model): - """The request that generated the event. - - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the - event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the - http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'addr': {'key': 'addr', 'type': 'str'}, - 'host': {'key': 'host', 'type': 'str'}, - 'method': {'key': 'method', 'type': 'str'}, - 'useragent': {'key': 'useragent', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.addr = kwargs.get('addr', None) - self.host = kwargs.get('host', None) - self.method = kwargs.get('method', None) - self.useragent = kwargs.get('useragent', None) - - -class RetentionPolicy(msrest.serialization.Model): - """The retention policy for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int - :ivar last_updated_time: The timestamp when the policy was last updated. - :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus - """ - - _validation = { - 'last_updated_time': {'readonly': True}, - } - - _attribute_map = { - 'days': {'key': 'days', 'type': 'int'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RetentionPolicy, self).__init__(**kwargs) - self.days = kwargs.get('days', 7) - self.last_updated_time = None - self.status = kwargs.get('status', None) - - -class ScopeMap(ProxyResource): - """An object that represents a scope map for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str - :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. - :vartype type_properties_type: str - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. - E.g. repositories/repository-name/content/read, - repositories/repository-name/metadata/write. - :type actions: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'type_properties_type': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMap, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.type_properties_type = None - self.creation_date = None - self.provisioning_state = None - self.actions = kwargs.get('actions', None) - - -class ScopeMapListResult(msrest.serialization.Model): - """The result of a request to list scope maps for a container registry. - - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field - should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScopeMap]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ScopeMapUpdateParameters(msrest.serialization.Model): - """The properties for updating the scope map. - - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. - E.g. repositories/repository-name/pull, - repositories/repository-name/delete. - :type actions: list[str] - """ - - _attribute_map = { - 'description': {'key': 'properties.description', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapUpdateParameters, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.actions = kwargs.get('actions', None) - - -class Sku(msrest.serialization.Model): - """The SKU of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name of the container registry. Required for registry creation. - Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuName - :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class Source(msrest.serialization.Model): - """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - - :param addr: The IP or hostname and the port of the registry node that generated the event. - Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str - """ - - _attribute_map = { - 'addr': {'key': 'addr', 'type': 'str'}, - 'instance_id': {'key': 'instanceID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Source, self).__init__(**kwargs) - self.addr = kwargs.get('addr', None) - self.instance_id = kwargs.get('instance_id', None) - - -class Status(msrest.serialization.Model): - """The status of an Azure resource at the time the operation was called. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_status: The short label for the status. - :vartype display_status: str - :ivar message: The detailed message for the status, including alerts and error messages. - :vartype message: str - :ivar timestamp: The timestamp when the status was changed to the current value. - :vartype timestamp: ~datetime.datetime - """ - - _validation = { - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'timestamp': {'readonly': True}, - } - - _attribute_map = { - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Status, self).__init__(**kwargs) - self.display_status = None - self.message = None - self.timestamp = None - - -class StatusDetailProperties(msrest.serialization.Model): - """The status detail properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The component of the connected registry corresponding to the status. - :vartype type: str - :ivar code: The code of the status. - :vartype code: str - :ivar description: The description of the status. - :vartype description: str - :ivar timestamp: The timestamp of the status. - :vartype timestamp: ~datetime.datetime - :ivar correlation_id: The correlation ID of the status. - :vartype correlation_id: str - """ - - _validation = { - 'type': {'readonly': True}, - 'code': {'readonly': True}, - 'description': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'correlation_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StatusDetailProperties, self).__init__(**kwargs) - self.type = None - self.code = None - self.description = None - self.timestamp = None - self.correlation_id = None - - -class SyncProperties(msrest.serialization.Model): - """The sync properties of the connected registry with its parent. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param token_id: Required. The resource ID of the ACR token used to authenticate the connected - registry to its parent during sync. - :type token_id: str - :param schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. - Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: Required. The period of time for which a message is available to sync - before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per - ISO8601. - :type message_ttl: ~datetime.timedelta - :ivar last_sync_time: The last time a sync occurred between the connected registry and its - parent. - :vartype last_sync_time: ~datetime.datetime - :ivar gateway_endpoint: The gateway endpoint used by the connected registry to communicate with - its parent. - :vartype gateway_endpoint: str - """ - - _validation = { - 'token_id': {'required': True}, - 'message_ttl': {'required': True}, - 'last_sync_time': {'readonly': True}, - 'gateway_endpoint': {'readonly': True}, - } - - _attribute_map = { - 'token_id': {'key': 'tokenId', 'type': 'str'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, - 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'gateway_endpoint': {'key': 'gatewayEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncProperties, self).__init__(**kwargs) - self.token_id = kwargs['token_id'] - self.schedule = kwargs.get('schedule', None) - self.sync_window = kwargs.get('sync_window', None) - self.message_ttl = kwargs['message_ttl'] - self.last_sync_time = None - self.gateway_endpoint = None - - -class SyncUpdateProperties(msrest.serialization.Model): - """The parameters for updating the sync properties of the connected registry with its parent. - - :param schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. - Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: The period of time for which a message is available to sync before it is - expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type message_ttl: ~datetime.timedelta - """ - - _attribute_map = { - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, - 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncUpdateProperties, self).__init__(**kwargs) - self.schedule = kwargs.get('schedule', None) - self.sync_window = kwargs.get('sync_window', None) - self.message_ttl = kwargs.get('message_ttl', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Target(msrest.serialization.Model): - """The target of the event. - - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str - """ - - _attribute_map = { - 'media_type': {'key': 'mediaType', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'long'}, - 'digest': {'key': 'digest', 'type': 'str'}, - 'length': {'key': 'length', 'type': 'long'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Target, self).__init__(**kwargs) - self.media_type = kwargs.get('media_type', None) - self.size = kwargs.get('size', None) - self.digest = kwargs.get('digest', None) - self.length = kwargs.get('length', None) - self.repository = kwargs.get('repository', None) - self.url = kwargs.get('url', None) - self.tag = kwargs.get('tag', None) - self.name = kwargs.get('name', None) - self.version = kwargs.get('version', None) - - -class TlsCertificateProperties(msrest.serialization.Model): - """The TLS certificate properties of the connected registry login server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of certificate location. Possible values include: "LocalDirectory". - :vartype type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CertificateType - :ivar location: Indicates the location of the certificates. - :vartype location: str - """ - - _validation = { - 'type': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TlsCertificateProperties, self).__init__(**kwargs) - self.type = None - self.location = None - - -class TlsProperties(msrest.serialization.Model): - """The TLS properties of the connected registry login server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: Indicates whether HTTPS is enabled for the login server. Possible values include: - "Enabled", "Disabled". - :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsStatus - :ivar certificate: The certificate used to configure HTTPS for the login server. - :vartype certificate: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsCertificateProperties - """ - - _validation = { - 'status': {'readonly': True}, - 'certificate': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'TlsCertificateProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TlsProperties, self).__init__(**kwargs) - self.status = None - self.certificate = None - - -class Token(ProxyResource): - """An object that represents a token for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Token, self).__init__(**kwargs) - self.creation_date = None - self.provisioning_state = None - self.scope_map_id = kwargs.get('scope_map_id', None) - self.credentials = kwargs.get('credentials', None) - self.status = kwargs.get('status', None) - - -class TokenCertificate(msrest.serialization.Model): - """The properties of a certificate used for authenticating a token. - - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format - that will be used for authenticating the token. - :type encoded_pem_certificate: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'encoded_pem_certificate': {'key': 'encodedPemCertificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCertificate, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.expiry = kwargs.get('expiry', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.encoded_pem_certificate = kwargs.get('encoded_pem_certificate', None) - - -class TokenCredentialsProperties(msrest.serialization.Model): - """The properties of the credentials that can be used for authenticating the token. - - :param certificates: - :type certificates: - list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'certificates': {'key': 'certificates', 'type': '[TokenCertificate]'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCredentialsProperties, self).__init__(**kwargs) - self.certificates = kwargs.get('certificates', None) - self.passwords = kwargs.get('passwords', None) - - -class TokenListResult(msrest.serialization.Model): - """The result of a request to list tokens for a container registry. - - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should - be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Token]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TokenPassword(msrest.serialization.Model): - """The password that will be used for authenticating the token of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName - :ivar value: The password value. - :vartype value: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenPassword, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - self.value = None - - -class TokenUpdateParameters(msrest.serialization.Model): - """The parameters for updating a token. - - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties - """ - - _attribute_map = { - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenUpdateParameters, self).__init__(**kwargs) - self.scope_map_id = kwargs.get('scope_map_id', None) - self.status = kwargs.get('status', None) - self.credentials = kwargs.get('credentials', None) - - -class TrustPolicy(msrest.serialization.Model): - """The content trust policy for a container registry. - - :param type: The type of trust policy. Possible values include: "Notary". Default value: - "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustPolicy, self).__init__(**kwargs) - self.type = kwargs.get('type', "Notary") - self.status = kwargs.get('status', None) - - -class UserIdentityProperties(msrest.serialization.Model): - """UserIdentityProperties. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual network rule. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - - -class Webhook(Resource): - """An object that represents a webhook for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] - :ivar provisioning_state: The provisioning state of the webhook at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Webhook, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - self.provisioning_state = None - - -class WebhookCreateParameters(msrest.serialization.Model): - """The parameters for creating a webhook. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the - resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - - -class WebhookListResult(msrest.serialization.Model): - """The result of a request to list webhooks for a container registry. - - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Webhook]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WebhookUpdateParameters(msrest.serialization.Model): - """The parameters for updating a webhook. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py index e79bfa7c8fb8..51006041b011 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py @@ -38,6 +38,8 @@ def __init__( self, **kwargs ): + """ + """ super(ActivationProperties, self).__init__(**kwargs) self.status = None @@ -45,12 +47,12 @@ def __init__( class ActiveDirectoryObject(msrest.serialization.Model): """The Active Directory Object that will be used for authenticating the token of a container registry. - :param object_id: The user/group/application object ID for Active Directory Object that will be + :ivar object_id: The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that + :vartype object_id: str + :ivar tenant_id: The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. - :type tenant_id: str + :vartype tenant_id: str """ _attribute_map = { @@ -65,6 +67,14 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword object_id: The user/group/application object ID for Active Directory Object that will + be used for authenticating the token of a container registry. + :paramtype object_id: str + :keyword tenant_id: The tenant ID of user/group/application object Active Directory Object that + will be used for authenticating the token of a container registry. + :paramtype tenant_id: str + """ super(ActiveDirectoryObject, self).__init__(**kwargs) self.object_id = object_id self.tenant_id = tenant_id @@ -73,9 +83,9 @@ def __init__( class Actor(msrest.serialization.Model): """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :param name: The subject or username associated with the request context that generated the + :ivar name: The subject or username associated with the request context that generated the event. - :type name: str + :vartype name: str """ _attribute_map = { @@ -88,6 +98,11 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The subject or username associated with the request context that generated the + event. + :paramtype name: str + """ super(Actor, self).__init__(**kwargs) self.name = name @@ -97,10 +112,10 @@ class CallbackConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] + :ivar service_uri: Required. The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] """ _validation = { @@ -119,6 +134,12 @@ def __init__( custom_headers: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword service_uri: Required. The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + """ super(CallbackConfig, self).__init__(**kwargs) self.service_uri = service_uri self.custom_headers = custom_headers @@ -157,6 +178,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -181,9 +204,9 @@ class ConnectedRegistry(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param mode: The mode of the connected registry resource that indicates the permissions of the + :ivar mode: The mode of the connected registry resource that indicates the permissions of the registry. Possible values include: "Registry", "Mirror". - :type mode: str or + :vartype mode: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryMode :ivar version: The current version of ACR runtime on the connected registry. :vartype version: str @@ -196,16 +219,16 @@ class ConnectedRegistry(ProxyResource): :ivar activation: The activation properties of the connected registry. :vartype activation: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActivationProperties - :param parent: The parent of the connected registry. - :type parent: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ParentProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + :ivar parent: The parent of the connected registry. + :vartype parent: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ParentProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to the connected registry. - :type client_token_ids: list[str] - :param login_server: The login server properties of the connected registry. - :type login_server: + :vartype client_token_ids: list[str] + :ivar login_server: The login server properties of the connected registry. + :vartype login_server: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoginServerProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties :ivar status_details: The list of current statuses of the connected registry. :vartype status_details: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.StatusDetailProperties] @@ -252,6 +275,22 @@ def __init__( logging: Optional["LoggingProperties"] = None, **kwargs ): + """ + :keyword mode: The mode of the connected registry resource that indicates the permissions of + the registry. Possible values include: "Registry", "Mirror". + :paramtype mode: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryMode + :keyword parent: The parent of the connected registry. + :paramtype parent: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ParentProperties + :keyword client_token_ids: The list of the ACR token resource IDs used to authenticate clients + to the connected registry. + :paramtype client_token_ids: list[str] + :keyword login_server: The login server properties of the connected registry. + :paramtype login_server: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoginServerProperties + :keyword logging: The logging properties of the connected registry. + :paramtype logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + """ super(ConnectedRegistry, self).__init__(**kwargs) self.provisioning_state = None self.mode = mode @@ -269,11 +308,12 @@ def __init__( class ConnectedRegistryListResult(msrest.serialization.Model): """The result of a request to list connected registries for a container registry. - :param value: The list of connected registries. Since this list may be incomplete, the nextLink + :ivar value: The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next list of connected registries. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] - :param next_link: The URI that can be used to request the next list of connected registries. - :type next_link: str + :vartype value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :ivar next_link: The URI that can be used to request the next list of connected registries. + :vartype next_link: str """ _attribute_map = { @@ -288,6 +328,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of connected registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of connected registries. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :keyword next_link: The URI that can be used to request the next list of connected registries. + :paramtype next_link: str + """ super(ConnectedRegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -296,14 +344,14 @@ def __init__( class ConnectedRegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a connected registry. - :param sync_properties: The sync properties of the connected registry with its parent. - :type sync_properties: + :ivar sync_properties: The sync properties of the connected registry with its parent. + :vartype sync_properties: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncUpdateProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to the connected registry. - :type client_token_ids: list[str] + :vartype client_token_ids: list[str] """ _attribute_map = { @@ -320,6 +368,16 @@ def __init__( client_token_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword sync_properties: The sync properties of the connected registry with its parent. + :paramtype sync_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncUpdateProperties + :keyword logging: The logging properties of the connected registry. + :paramtype logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + :keyword client_token_ids: The list of the ACR token resource IDs used to authenticate clients + to the connected registry. + :paramtype client_token_ids: list[str] + """ super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) self.sync_properties = sync_properties self.logging = logging @@ -329,11 +387,12 @@ def __init__( class EncryptionProperty(msrest.serialization.Model): """EncryptionProperty. - :param status: Indicates whether or not the encryption is enabled for container registry. + :ivar status: Indicates whether or not the encryption is enabled for container registry. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: + :vartype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionStatus + :ivar key_vault_properties: Key vault properties. + :vartype key_vault_properties: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.KeyVaultProperties """ @@ -349,6 +408,15 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionStatus + :keyword key_vault_properties: Key vault properties. + :paramtype key_vault_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.KeyVaultProperties + """ super(EncryptionProperty, self).__init__(**kwargs) self.status = status self.key_vault_properties = key_vault_properties @@ -357,8 +425,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the Azure Container Registry service. - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ErrorResponseBody + :ivar error: Azure container registry build API error body. + :vartype error: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ErrorResponseBody """ _attribute_map = { @@ -371,6 +439,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure container registry build API error body. + :paramtype error: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -380,15 +452,16 @@ class ErrorResponseBody(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str + :ivar details: an array of additional nested error response info objects, as described by this contract. - :type details: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.InnerErrorDescription + :vartype details: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.InnerErrorDescription] """ _validation = { @@ -400,7 +473,7 @@ class ErrorResponseBody(msrest.serialization.Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, + 'details': {'key': 'details', 'type': '[InnerErrorDescription]'}, } def __init__( @@ -409,9 +482,21 @@ def __init__( code: str, message: str, target: Optional[str] = None, - details: Optional["InnerErrorDescription"] = None, + details: Optional[List["InnerErrorDescription"]] = None, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + :keyword details: an array of additional nested error response info objects, as described by + this contract. + :paramtype details: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.InnerErrorDescription] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -422,8 +507,8 @@ def __init__( class EventInfo(msrest.serialization.Model): """The basic information of an event. - :param id: The event ID. - :type id: str + :ivar id: The event ID. + :vartype id: str """ _attribute_map = { @@ -436,6 +521,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + """ super(EventInfo, self).__init__(**kwargs) self.id = id @@ -443,13 +532,13 @@ def __init__( class Event(EventInfo): """The event for a webhook. - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: + :ivar id: The event ID. + :vartype id: str + :ivar event_request_message: The event request message sent to the service URI. + :vartype event_request_message: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventResponseMessage """ @@ -467,6 +556,16 @@ def __init__( event_response_message: Optional["EventResponseMessage"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword event_request_message: The event request message sent to the service URI. + :paramtype event_request_message: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventRequestMessage + :keyword event_response_message: The event response message received from the service URI. + :paramtype event_response_message: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventResponseMessage + """ super(Event, self).__init__(id=id, **kwargs) self.event_request_message = event_request_message self.event_response_message = event_response_message @@ -475,22 +574,22 @@ def __init__( class EventContent(msrest.serialization.Model): """The content of the event request message. - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar target: The target of the event. + :vartype target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Request + :ivar actor: The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor + :vartype actor: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Actor + :ivar source: The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Source + :vartype source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Source """ _attribute_map = { @@ -515,6 +614,24 @@ def __init__( source: Optional["Source"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword timestamp: The time at which the event occurred. + :paramtype timestamp: ~datetime.datetime + :keyword action: The action that encompasses the provided event. + :paramtype action: str + :keyword target: The target of the event. + :paramtype target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Target + :keyword request: The request that generated the event. + :paramtype request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Request + :keyword actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :paramtype actor: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Actor + :keyword source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :paramtype source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Source + """ super(EventContent, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -528,11 +645,11 @@ def __init__( class EventListResult(msrest.serialization.Model): """The result of a request to list events for a webhook. - :param value: The list of events. Since this list may be incomplete, the nextLink field should + :ivar value: The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Event] + :ivar next_link: The URI that can be used to request the next list of events. + :vartype next_link: str """ _attribute_map = { @@ -547,6 +664,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of events. Since this list may be incomplete, the nextLink field + should be used to request the next list of events. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Event] + :keyword next_link: The URI that can be used to request the next list of events. + :paramtype next_link: str + """ super(EventListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -555,16 +679,16 @@ def __init__( class EventRequestMessage(msrest.serialization.Model): """The event request message sent to the service URI. - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventContent + :ivar headers: The headers of the event request message. + :vartype headers: dict[str, str] + :ivar method: The HTTP method used to send the event request message. + :vartype method: str + :ivar request_uri: The URI used to send the event request message. + :vartype request_uri: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -585,6 +709,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event request message. + :paramtype content: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventContent + :keyword headers: The headers of the event request message. + :paramtype headers: dict[str, str] + :keyword method: The HTTP method used to send the event request message. + :paramtype method: str + :keyword request_uri: The URI used to send the event request message. + :paramtype request_uri: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventRequestMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -596,16 +732,16 @@ def __init__( class EventResponseMessage(msrest.serialization.Model): """The event response message received from the service URI. - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event response message. + :vartype content: str + :ivar headers: The headers of the event response message. + :vartype headers: dict[str, str] + :ivar reason_phrase: The reason phrase of the event response message. + :vartype reason_phrase: str + :ivar status_code: The status code of the event response message. + :vartype status_code: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -626,6 +762,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event response message. + :paramtype content: str + :keyword headers: The headers of the event response message. + :paramtype headers: dict[str, str] + :keyword reason_phrase: The reason phrase of the event response message. + :paramtype reason_phrase: str + :keyword status_code: The status code of the event response message. + :paramtype status_code: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventResponseMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -647,15 +795,15 @@ class ExportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: + :ivar location: The location of the export pipeline. + :vartype location: str + :ivar identity: The identity of the export pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :ivar target: The target properties of the export pipeline. + :vartype target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -693,6 +841,19 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the export pipeline. + :paramtype location: str + :keyword identity: The identity of the export pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :keyword target: The target properties of the export pipeline. + :paramtype target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] + """ super(ExportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -704,11 +865,11 @@ def __init__( class ExportPipelineListResult(msrest.serialization.Model): """The result of a request to list export pipelines for a container registry. - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -723,6 +884,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of export pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of export pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ExportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -733,15 +901,15 @@ class ExportPipelineTargetProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. + :ivar type: The type of target for the export pipeline. + :vartype type: str + :ivar uri: The target uri of the export pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -762,6 +930,17 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of target for the export pipeline. + :paramtype type: str + :keyword uri: The target uri of the export pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + token. + :paramtype key_vault_uri: str + """ super(ExportPipelineTargetProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -771,9 +950,9 @@ def __init__( class ExportPolicy(msrest.serialization.Model): """The export policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". Default value: "enabled". - :type status: str or + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicyStatus """ @@ -787,6 +966,12 @@ def __init__( status: Optional[Union[str, "ExportPolicyStatus"]] = "enabled", **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". Default value: "enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicyStatus + """ super(ExportPolicy, self).__init__(**kwargs) self.status = status @@ -794,14 +979,15 @@ def __init__( class GenerateCredentialsParameters(msrest.serialization.Model): """The parameters used to generate credentials for a specified token or user of a container registry. - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become + :ivar token_id: The resource ID of the token for which credentials have to be generated. + :vartype token_id: str + :ivar expiry: The expiry date of the generated credentials after which the credentials become invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or + :vartype expiry: ~datetime.datetime + :ivar name: Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + :vartype name: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName """ _attribute_map = { @@ -818,6 +1004,17 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword token_id: The resource ID of the token for which credentials have to be generated. + :paramtype token_id: str + :keyword expiry: The expiry date of the generated credentials after which the credentials + become invalid. + :paramtype expiry: ~datetime.datetime + :keyword name: Specifies name of the password which should be regenerated if any -- password1 + or password2. Possible values include: "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + """ super(GenerateCredentialsParameters, self).__init__(**kwargs) self.token_id = token_id self.expiry = expiry @@ -827,10 +1024,11 @@ def __init__( class GenerateCredentialsResult(msrest.serialization.Model): """The response from the GenerateCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] """ _attribute_map = { @@ -845,6 +1043,13 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + """ super(GenerateCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -853,20 +1058,20 @@ def __init__( class IdentityProperties(msrest.serialization.Model): """Managed identity for the resource. - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or + :vartype type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.containerregistry.v2021_06_01_preview.models.UserIdentityProperties] """ @@ -886,6 +1091,23 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.UserIdentityProperties] + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id @@ -898,18 +1120,18 @@ class ImportImageParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + :ivar source: Required. The source of the image. + :vartype source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSource + :ivar target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only + :vartype target_tags: list[str] + :ivar untagged_target_repositories: List of strings of repository names to do a manifest only copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + :vartype untagged_target_repositories: list[str] + :ivar mode: When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportMode + :vartype mode: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportMode """ _validation = { @@ -932,6 +1154,20 @@ def __init__( mode: Optional[Union[str, "ImportMode"]] = "NoForce", **kwargs ): + """ + :keyword source: Required. The source of the image. + :paramtype source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSource + :keyword target_tags: List of strings of the form repo[:tag]. When tag is omitted the source + will be used (or 'latest' if source tag is also omitted). + :paramtype target_tags: list[str] + :keyword untagged_target_repositories: List of strings of repository names to do a manifest + only copy. No tag will be created. + :paramtype untagged_target_repositories: list[str] + :keyword mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :paramtype mode: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportMode + """ super(ImportImageParameters, self).__init__(**kwargs) self.source = source self.target_tags = target_tags @@ -952,18 +1188,18 @@ class ImportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: + :ivar location: The location of the import pipeline. + :vartype location: str + :ivar identity: The identity of the import pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :ivar source: The source properties of the import pipeline. + :vartype source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: + :ivar trigger: The properties that describe the trigger of the import pipeline. + :vartype trigger: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -1003,6 +1239,22 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the import pipeline. + :paramtype location: str + :keyword identity: The identity of the import pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :keyword source: The source properties of the import pipeline. + :paramtype source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties + :keyword trigger: The properties that describe the trigger of the import pipeline. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] + """ super(ImportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -1015,11 +1267,11 @@ def __init__( class ImportPipelineListResult(msrest.serialization.Model): """The result of a request to list import pipelines for a container registry. - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -1034,6 +1286,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of import pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of import pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ImportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1044,16 +1303,17 @@ class ImportPipelineSourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of source for the import pipeline. Possible values include: + :ivar type: The type of source for the import pipeline. Possible values include: "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. + :vartype type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceType + :ivar uri: The source uri of the import pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -1074,6 +1334,19 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of source for the import pipeline. Possible values include: + "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceType + :keyword uri: The source uri of the import pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + token. + :paramtype key_vault_uri: str + """ super(ImportPipelineSourceProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -1085,18 +1358,18 @@ class ImportSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: + :ivar resource_id: The resource identifier of the source Azure Container Registry. + :vartype resource_id: str + :ivar registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :vartype registry_uri: str + :ivar credentials: Credentials used when importing from a registry uri. + :vartype credentials: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. + :ivar source_image: Required. Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str + :vartype source_image: str """ _validation = { @@ -1119,6 +1392,20 @@ def __init__( credentials: Optional["ImportSourceCredentials"] = None, **kwargs ): + """ + :keyword resource_id: The resource identifier of the source Azure Container Registry. + :paramtype resource_id: str + :keyword registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :paramtype registry_uri: str + :keyword credentials: Credentials used when importing from a registry uri. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSourceCredentials + :keyword source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype source_image: str + """ super(ImportSource, self).__init__(**kwargs) self.resource_id = resource_id self.registry_uri = registry_uri @@ -1131,10 +1418,10 @@ class ImportSourceCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: Required. The password used to authenticate with the source registry. + :vartype password: str """ _validation = { @@ -1153,6 +1440,12 @@ def __init__( username: Optional[str] = None, **kwargs ): + """ + :keyword username: The username to authenticate with the source registry. + :paramtype username: str + :keyword password: Required. The password used to authenticate with the source registry. + :paramtype password: str + """ super(ImportSourceCredentials, self).__init__(**kwargs) self.username = username self.password = password @@ -1163,12 +1456,12 @@ class InnerErrorDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str """ _validation = { @@ -1190,6 +1483,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + """ super(InnerErrorDescription, self).__init__(**kwargs) self.code = code self.message = message @@ -1201,11 +1502,11 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar action: The action of IP ACL rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str + :vartype ip_address_or_range: str """ _validation = { @@ -1224,6 +1525,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of IP ACL rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + """ super(IPRule, self).__init__(**kwargs) self.action = action self.ip_address_or_range = ip_address_or_range @@ -1234,13 +1542,13 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str + :ivar key_identifier: Key vault uri to access the encryption key. + :vartype key_identifier: str :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of the key that is actually used for encryption. :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str + :ivar identity: The client id of the identity which will be used to access key vault. + :vartype identity: str :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. :vartype key_rotation_enabled: bool :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. @@ -1268,6 +1576,12 @@ def __init__( identity: Optional[str] = None, **kwargs ): + """ + :keyword key_identifier: Key vault uri to access the encryption key. + :paramtype key_identifier: str + :keyword identity: The client id of the identity which will be used to access key vault. + :paramtype identity: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_identifier = key_identifier self.versioned_key_identifier = None @@ -1279,12 +1593,12 @@ def __init__( class LoggingProperties(msrest.serialization.Model): """The logging properties of the connected registry. - :param log_level: The verbosity of logs persisted on the connected registry. Possible values + :ivar log_level: The verbosity of logs persisted on the connected registry. Possible values include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". - :type log_level: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LogLevel - :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. + :vartype log_level: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LogLevel + :ivar audit_log_status: Indicates whether audit logs are enabled on the connected registry. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type audit_log_status: str or + :vartype audit_log_status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.AuditLogStatus """ @@ -1300,6 +1614,15 @@ def __init__( audit_log_status: Optional[Union[str, "AuditLogStatus"]] = "Disabled", **kwargs ): + """ + :keyword log_level: The verbosity of logs persisted on the connected registry. Possible values + include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". + :paramtype log_level: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LogLevel + :keyword audit_log_status: Indicates whether audit logs are enabled on the connected registry. + Possible values include: "Enabled", "Disabled". Default value: "Disabled". + :paramtype audit_log_status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.AuditLogStatus + """ super(LoggingProperties, self).__init__(**kwargs) self.log_level = log_level self.audit_log_status = audit_log_status @@ -1330,6 +1653,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoginServerProperties, self).__init__(**kwargs) self.host = None self.tls = None @@ -1340,15 +1665,15 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param default_action: Required. The default action of allow or deny when no other rules match. + :ivar default_action: Required. The default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or + :vartype default_action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: + :ivar virtual_network_rules: The virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.IPRule] + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.IPRule] """ _validation = { @@ -1369,6 +1694,17 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword default_action: Required. The default action of allow or deny when no other rules + match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.DefaultAction + :keyword virtual_network_rules: The virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.VirtualNetworkRule] + :keyword ip_rules: The IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.IPRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules @@ -1378,19 +1714,19 @@ def __init__( class OperationDefinition(msrest.serialization.Model): """The definition of a container registry operation. - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: + :ivar origin: The origin information of the container registry operation. + :vartype origin: str + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDisplayDefinition - :param is_data_action: This property indicates if the operation is an action or a data action + :ivar is_data_action: This property indicates if the operation is an action or a data action ref: https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. - :type is_data_action: bool - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: + :vartype is_data_action: bool + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationServiceSpecificationDefinition """ @@ -1412,6 +1748,22 @@ def __init__( service_specification: Optional["OperationServiceSpecificationDefinition"] = None, **kwargs ): + """ + :keyword origin: The origin information of the container registry operation. + :paramtype origin: str + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDisplayDefinition + :keyword is_data_action: This property indicates if the operation is an action or a data action + ref: + https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. + :paramtype is_data_action: bool + :keyword service_specification: The definition of Azure Monitoring service. + :paramtype service_specification: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationServiceSpecificationDefinition + """ super(OperationDefinition, self).__init__(**kwargs) self.origin = origin self.name = name @@ -1423,14 +1775,14 @@ def __init__( class OperationDisplayDefinition(msrest.serialization.Model): """The display information for a container registry operation. - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str """ _attribute_map = { @@ -1449,6 +1801,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ super(OperationDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1459,12 +1821,13 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The result of a request to list container registry operations. - :param value: The list of container registry operations. Since this list may be incomplete, the + :ivar value: The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry + :vartype value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry operations. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1479,6 +1842,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1487,12 +1859,12 @@ def __init__( class OperationLogSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring log. - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str + :ivar name: Log name. + :vartype name: str + :ivar display_name: Log display name. + :vartype display_name: str + :ivar blob_duration: Log blob duration. + :vartype blob_duration: str """ _attribute_map = { @@ -1509,6 +1881,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Log name. + :paramtype name: str + :keyword display_name: Log display name. + :paramtype display_name: str + :keyword blob_duration: Log blob duration. + :paramtype blob_duration: str + """ super(OperationLogSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1518,18 +1898,18 @@ def __init__( class OperationMetricSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring metric. - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str + :ivar name: Metric name. + :vartype name: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -1552,6 +1932,20 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Metric name. + :paramtype name: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword unit: Metric unit. + :paramtype unit: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword internal_metric_name: Internal metric name. + :paramtype internal_metric_name: str + """ super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1564,11 +1958,11 @@ def __init__( class OperationServiceSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring list. - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: + :ivar log_specifications: A list of Azure Monitoring log definitions. + :vartype log_specifications: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationLogSpecificationDefinition] """ @@ -1584,6 +1978,14 @@ def __init__( log_specifications: Optional[List["OperationLogSpecificationDefinition"]] = None, **kwargs ): + """ + :keyword metric_specifications: A list of Azure Monitoring metrics definition. + :paramtype metric_specifications: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationMetricSpecificationDefinition] + :keyword log_specifications: A list of Azure Monitoring log definitions. + :paramtype log_specifications: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationLogSpecificationDefinition] + """ super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -1594,11 +1996,11 @@ class ParentProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: The resource ID of the parent to which the connected registry will be associated. - :type id: str - :param sync_properties: Required. The sync properties of the connected registry with its - parent. - :type sync_properties: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncProperties + :ivar id: The resource ID of the parent to which the connected registry will be associated. + :vartype id: str + :ivar sync_properties: Required. The sync properties of the connected registry with its parent. + :vartype sync_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncProperties """ _validation = { @@ -1617,6 +2019,14 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The resource ID of the parent to which the connected registry will be associated. + :paramtype id: str + :keyword sync_properties: Required. The sync properties of the connected registry with its + parent. + :paramtype sync_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncProperties + """ super(ParentProperties, self).__init__(**kwargs) self.id = id self.sync_properties = sync_properties @@ -1639,13 +2049,13 @@ class PipelineRun(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunRequest + :ivar request: The request parameters for a pipeline run. + :vartype request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunRequest :ivar response: The response of a pipeline run. :vartype response: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline + :ivar force_update_tag: How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - :type force_update_tag: str + :vartype force_update_tag: str """ _validation = { @@ -1675,6 +2085,13 @@ def __init__( force_update_tag: Optional[str] = None, **kwargs ): + """ + :keyword request: The request parameters for a pipeline run. + :paramtype request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunRequest + :keyword force_update_tag: How the pipeline run should be forced to recreate even if the + pipeline run configuration has not changed. + :paramtype force_update_tag: str + """ super(PipelineRun, self).__init__(**kwargs) self.provisioning_state = None self.request = request @@ -1685,11 +2102,11 @@ def __init__( class PipelineRunListResult(msrest.serialization.Model): """The result of a request to list pipeline runs for a container registry. - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field + :ivar value: The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -1704,6 +2121,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of pipeline runs. Since this list may be incomplete, the nextLink + field should be used to request the next list of pipeline runs. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(PipelineRunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1712,21 +2136,21 @@ def __init__( class PipelineRunRequest(msrest.serialization.Model): """The request properties provided for a pipeline run. - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. + :ivar pipeline_resource_id: The resource ID of the pipeline to run. + :vartype pipeline_resource_id: str + :ivar artifacts: List of source artifacts to be transferred by the pipeline. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: + :vartype artifacts: list[str] + :ivar source: The source properties of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: + :ivar target: The target properties of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str """ _attribute_map = { @@ -1747,6 +2171,23 @@ def __init__( catalog_digest: Optional[str] = None, **kwargs ): + """ + :keyword pipeline_resource_id: The resource ID of the pipeline to run. + :paramtype pipeline_resource_id: str + :keyword artifacts: List of source artifacts to be transferred by the pipeline. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype artifacts: list[str] + :keyword source: The source properties of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceProperties + :keyword target: The target properties of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + """ super(PipelineRunRequest, self).__init__(**kwargs) self.pipeline_resource_id = pipeline_resource_id self.artifacts = artifacts @@ -1758,30 +2199,30 @@ def __init__( class PipelineRunResponse(msrest.serialization.Model): """The response properties returned for a pipeline run. - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: + :ivar status: The current status of the pipeline run. + :vartype status: str + :ivar imported_artifacts: The artifacts imported in the pipeline run. + :vartype imported_artifacts: list[str] + :ivar progress: The current progress of the copy operation. + :vartype progress: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProgressProperties + :ivar start_time: The time the pipeline run started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the pipeline run finished. + :vartype finish_time: ~datetime.datetime + :ivar source: The source of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: + :ivar target: The target of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str + :ivar trigger: The trigger that caused the pipeline run. + :vartype trigger: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case + :ivar pipeline_run_error_message: The detailed error message for the pipeline run in the case of failure. - :type pipeline_run_error_message: str + :vartype pipeline_run_error_message: str """ _attribute_map = { @@ -1812,6 +2253,33 @@ def __init__( pipeline_run_error_message: Optional[str] = None, **kwargs ): + """ + :keyword status: The current status of the pipeline run. + :paramtype status: str + :keyword imported_artifacts: The artifacts imported in the pipeline run. + :paramtype imported_artifacts: list[str] + :keyword progress: The current progress of the copy operation. + :paramtype progress: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProgressProperties + :keyword start_time: The time the pipeline run started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the pipeline run finished. + :paramtype finish_time: ~datetime.datetime + :keyword source: The source of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties + :keyword target: The target of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + :keyword trigger: The trigger that caused the pipeline run. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerDescriptor + :keyword pipeline_run_error_message: The detailed error message for the pipeline run in the + case of failure. + :paramtype pipeline_run_error_message: str + """ super(PipelineRunResponse, self).__init__(**kwargs) self.status = status self.imported_artifacts = imported_artifacts @@ -1828,12 +2296,12 @@ def __init__( class PipelineRunSourceProperties(msrest.serialization.Model): """PipelineRunSourceProperties. - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the source. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str + :ivar name: The name of the source. + :vartype name: str """ _attribute_map = { @@ -1848,6 +2316,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the source. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceType + :keyword name: The name of the source. + :paramtype name: str + """ super(PipelineRunSourceProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1856,12 +2332,12 @@ def __init__( class PipelineRunTargetProperties(msrest.serialization.Model): """PipelineRunTargetProperties. - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the target. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str + :ivar name: The name of the target. + :vartype name: str """ _attribute_map = { @@ -1876,6 +2352,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the target. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetType + :keyword name: The name of the target. + :paramtype name: str + """ super(PipelineRunTargetProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1884,8 +2368,8 @@ def __init__( class PipelineSourceTriggerDescriptor(msrest.serialization.Model): """PipelineSourceTriggerDescriptor. - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime + :ivar timestamp: The timestamp when the source update happened. + :vartype timestamp: ~datetime.datetime """ _attribute_map = { @@ -1898,6 +2382,10 @@ def __init__( timestamp: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword timestamp: The timestamp when the source update happened. + :paramtype timestamp: ~datetime.datetime + """ super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) self.timestamp = timestamp @@ -1907,9 +2395,9 @@ class PipelineSourceTriggerProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The current status of the source trigger. Possible values include: + :ivar status: Required. The current status of the source trigger. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TriggerStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TriggerStatus """ _validation = { @@ -1926,6 +2414,12 @@ def __init__( status: Union[str, "TriggerStatus"] = "Enabled", **kwargs ): + """ + :keyword status: Required. The current status of the source trigger. Possible values include: + "Enabled", "Disabled". Default value: "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TriggerStatus + """ super(PipelineSourceTriggerProperties, self).__init__(**kwargs) self.status = status @@ -1933,8 +2427,8 @@ def __init__( class PipelineTriggerDescriptor(msrest.serialization.Model): """PipelineTriggerDescriptor. - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: + :ivar source_trigger: The source trigger that caused the pipeline run. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerDescriptor """ @@ -1948,6 +2442,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerDescriptor"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger that caused the pipeline run. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerDescriptor + """ super(PipelineTriggerDescriptor, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1955,8 +2454,8 @@ def __init__( class PipelineTriggerProperties(msrest.serialization.Model): """PipelineTriggerProperties. - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: + :ivar source_trigger: The source trigger properties of the pipeline. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerProperties """ @@ -1970,6 +2469,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerProperties"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger properties of the pipeline. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerProperties + """ super(PipelineTriggerProperties, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1977,16 +2481,16 @@ def __init__( class Policies(msrest.serialization.Model): """The policies for a container registry. - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: + :ivar quarantine_policy: The quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: + :ivar trust_policy: The content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicy + :ivar retention_policy: The retention policy for a container registry. + :vartype retention_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RetentionPolicy - :param export_policy: The export policy for a container registry. - :type export_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicy + :ivar export_policy: The export policy for a container registry. + :vartype export_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicy """ _attribute_map = { @@ -2005,6 +2509,18 @@ def __init__( export_policy: Optional["ExportPolicy"] = None, **kwargs ): + """ + :keyword quarantine_policy: The quarantine policy for a container registry. + :paramtype quarantine_policy: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.QuarantinePolicy + :keyword trust_policy: The content trust policy for a container registry. + :paramtype trust_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicy + :keyword retention_policy: The retention policy for a container registry. + :paramtype retention_policy: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RetentionPolicy + :keyword export_policy: The export policy for a container registry. + :paramtype export_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicy + """ super(Policies, self).__init__(**kwargs) self.quarantine_policy = quarantine_policy self.trust_policy = trust_policy @@ -2015,8 +2531,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """The Private Endpoint resource. - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str + :ivar id: This is private endpoint resource created with Microsoft.Network resource provider. + :vartype id: str """ _attribute_map = { @@ -2029,6 +2545,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: This is private endpoint resource created with Microsoft.Network resource + provider. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -2046,12 +2567,12 @@ class PrivateEndpointConnection(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of private endpoint connection resource. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -2084,6 +2605,15 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -2093,13 +2623,13 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """The result of a request to list private endpoint connections for a container registry. - :param value: The list of private endpoint connections. Since this list may be incomplete, the + :ivar value: The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - :type value: + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint + :ivar next_link: The URI that can be used to request the next list of private endpoint connections. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2114,6 +2644,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private endpoint connections. Since this list may be incomplete, + the nextLink field should be used to request the next list of private endpoint connections. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :keyword next_link: The URI that can be used to request the next list of private endpoint + connections. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2126,16 +2665,16 @@ class PrivateLinkResource(msrest.serialization.Model): :ivar type: The resource type is private link resource. :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -2161,6 +2700,18 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword id: The resource ID. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.type = None self.id = id @@ -2173,11 +2724,12 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """The result of a request to list private link resources for a container registry. - :param value: The list of private link resources. Since this list may be incomplete, the + :ivar value: The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str + :vartype value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResource] + :ivar next_link: The URI that can be used to request the next list of private link resources. + :vartype next_link: str """ _attribute_map = { @@ -2192,6 +2744,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResource] + :keyword next_link: The URI that can be used to request the next list of private link + resources. + :paramtype next_link: str + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2200,15 +2761,16 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :param status: The private link service connection status. Possible values include: "Approved", + :ivar status: The private link service connection status. Possible values include: "Approved", "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionStatus + :ivar description: The description for connection status. For example if connection is rejected + it can indicate reason for rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or + :vartype actions_required: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActionsRequired """ @@ -2226,6 +2788,19 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: The private link service connection status. Possible values include: + "Approved", "Pending", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionStatus + :keyword description: The description for connection status. For example if connection is + rejected it can indicate reason for rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :paramtype actions_required: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActionsRequired + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -2235,8 +2810,8 @@ def __init__( class ProgressProperties(msrest.serialization.Model): """ProgressProperties. - :param percentage: The percentage complete of the copy operation. - :type percentage: str + :ivar percentage: The percentage complete of the copy operation. + :vartype percentage: str """ _attribute_map = { @@ -2249,6 +2824,10 @@ def __init__( percentage: Optional[str] = None, **kwargs ): + """ + :keyword percentage: The percentage complete of the copy operation. + :paramtype percentage: str + """ super(ProgressProperties, self).__init__(**kwargs) self.percentage = percentage @@ -2256,9 +2835,9 @@ def __init__( class QuarantinePolicy(msrest.serialization.Model): """The quarantine policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus """ _attribute_map = { @@ -2271,6 +2850,11 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ super(QuarantinePolicy, self).__init__(**kwargs) self.status = status @@ -2280,9 +2864,9 @@ class RegenerateCredentialParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName """ _validation = { @@ -2299,6 +2883,11 @@ def __init__( name: Union[str, "PasswordName"], **kwargs ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + """ super(RegenerateCredentialParameters, self).__init__(**kwargs) self.name = name @@ -2316,11 +2905,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData """ @@ -2349,6 +2938,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -2371,17 +2967,17 @@ class Registry(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties :ivar login_server: The URL that can be used to log into the container registry. :vartype login_server: str :ivar creation_date: The creation date of the container registry in ISO8601 format. @@ -2393,16 +2989,18 @@ class Registry(Resource): ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState :ivar status: The status of the container registry at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool :ivar data_endpoint_host_names: List of host names that will serve data when dataEndpointEnabled is true. :vartype data_endpoint_host_names: list[str] @@ -2410,20 +3008,20 @@ class Registry(Resource): registry. :vartype private_endpoint_connections: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool """ _validation = { @@ -2485,6 +3083,44 @@ def __init__( anonymous_pull_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container + registry. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy + :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :paramtype anonymous_pull_enabled: bool + """ super(Registry, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity @@ -2508,10 +3144,10 @@ def __init__( class RegistryListCredentialsResult(msrest.serialization.Model): """The response from the ListCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryPassword] """ @@ -2527,6 +3163,13 @@ def __init__( passwords: Optional[List["RegistryPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryPassword] + """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -2535,11 +3178,11 @@ def __init__( class RegistryListResult(msrest.serialization.Model): """The result of a request to list container registries. - :param value: The list of container registries. Since this list may be incomplete, the nextLink + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str """ _attribute_map = { @@ -2554,6 +3197,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ super(RegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2566,8 +3216,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the container registry. - :type name: str + :ivar name: Required. The name of the container registry. + :vartype name: str :ivar type: The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". @@ -2592,6 +3242,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ super(RegistryNameCheckRequest, self).__init__(**kwargs) self.name = name @@ -2599,13 +3253,13 @@ def __init__( class RegistryNameStatus(msrest.serialization.Model): """The result of a request to check the availability of a container registry name. - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str """ _attribute_map = { @@ -2622,6 +3276,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ super(RegistryNameStatus, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2631,10 +3294,10 @@ def __init__( class RegistryPassword(msrest.serialization.Model): """The login password for the container registry. - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName - :param value: The password value. - :type value: str + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + :ivar value: The password value. + :vartype value: str """ _attribute_map = { @@ -2649,6 +3312,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ super(RegistryPassword, self).__init__(**kwargs) self.name = name self.value = value @@ -2657,32 +3326,34 @@ def __init__( class RegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a container registry. - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool """ _attribute_map = { @@ -2715,6 +3386,37 @@ def __init__( anonymous_pull_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions + :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :paramtype anonymous_pull_enabled: bool + """ super(RegistryUpdateParameters, self).__init__(**kwargs) self.identity = identity self.tags = tags @@ -2732,14 +3434,15 @@ def __init__( class RegistryUsage(msrest.serialization.Model): """The quota usage for a container registry. - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageUnit + :ivar name: The name of the usage. + :vartype name: str + :ivar limit: The limit of the usage. + :vartype limit: long + :ivar current_value: The current value of the usage. + :vartype current_value: long + :ivar unit: The unit of measurement. Possible values include: "Count", "Bytes". + :vartype unit: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageUnit """ _attribute_map = { @@ -2758,6 +3461,17 @@ def __init__( unit: Optional[Union[str, "RegistryUsageUnit"]] = None, **kwargs ): + """ + :keyword name: The name of the usage. + :paramtype name: str + :keyword limit: The limit of the usage. + :paramtype limit: long + :keyword current_value: The current value of the usage. + :paramtype current_value: long + :keyword unit: The unit of measurement. Possible values include: "Count", "Bytes". + :paramtype unit: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageUnit + """ super(RegistryUsage, self).__init__(**kwargs) self.name = name self.limit = limit @@ -2768,8 +3482,8 @@ def __init__( class RegistryUsageListResult(msrest.serialization.Model): """The result of a request to get container registry quota usages. - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsage] + :ivar value: The list of container registry quota usages. + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsage] """ _attribute_map = { @@ -2782,6 +3496,10 @@ def __init__( value: Optional[List["RegistryUsage"]] = None, **kwargs ): + """ + :keyword value: The list of container registry quota usages. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsage] + """ super(RegistryUsageListResult, self).__init__(**kwargs) self.value = value @@ -2799,11 +3517,11 @@ class Replication(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData :ivar provisioning_state: The provisioning state of the replication at the time the operation @@ -2813,13 +3531,13 @@ class Replication(Resource): ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState :ivar status: The status of the replication at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry + :vartype region_endpoint_enabled: bool + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry replication. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy """ @@ -2855,6 +3573,21 @@ def __init__( zone_redundancy: Optional[Union[str, "ZoneRedundancy"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container registry + replication. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy + """ super(Replication, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.status = None @@ -2865,11 +3598,11 @@ def __init__( class ReplicationListResult(msrest.serialization.Model): """The result of a request to list replications for a container registry. - :param value: The list of replications. Since this list may be incomplete, the nextLink field + :ivar value: The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :ivar next_link: The URI that can be used to request the next list of replications. + :vartype next_link: str """ _attribute_map = { @@ -2884,6 +3617,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :keyword next_link: The URI that can be used to request the next list of replications. + :paramtype next_link: str + """ super(ReplicationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2892,12 +3632,12 @@ def __init__( class ReplicationUpdateParameters(msrest.serialization.Model): """The parameters for updating a replication. - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar tags: A set of tags. The tags for the replication. + :vartype tags: dict[str, str] + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool + :vartype region_endpoint_enabled: bool """ _attribute_map = { @@ -2912,6 +3652,14 @@ def __init__( region_endpoint_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the replication. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + """ super(ReplicationUpdateParameters, self).__init__(**kwargs) self.tags = tags self.region_endpoint_enabled = region_endpoint_enabled @@ -2920,18 +3668,18 @@ def __init__( class Request(msrest.serialization.Model): """The request that generated the event. - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str """ _attribute_map = { @@ -2952,6 +3700,20 @@ def __init__( useragent: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the request that initiated the event. + :paramtype id: str + :keyword addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :paramtype addr: str + :keyword host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :paramtype host: str + :keyword method: The request method that generated the event. + :paramtype method: str + :keyword useragent: The user agent header of the request. + :paramtype useragent: str + """ super(Request, self).__init__(**kwargs) self.id = id self.addr = addr @@ -2965,13 +3727,13 @@ class RetentionPolicy(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int + :ivar days: The number of days to retain an untagged manifest after which it gets purged. + :vartype days: int :ivar last_updated_time: The timestamp when the policy was last updated. :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus """ _validation = { @@ -2991,6 +3753,13 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword days: The number of days to retain an untagged manifest after which it gets purged. + :paramtype days: int + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ super(RetentionPolicy, self).__init__(**kwargs) self.days = days self.last_updated_time = None @@ -3010,8 +3779,8 @@ class ScopeMap(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str + :ivar description: The user friendly description of the scope map. + :vartype description: str :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. :vartype type_properties_type: str :ivar creation_date: The creation date of scope map. @@ -3020,10 +3789,10 @@ class ScopeMap(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. + :ivar actions: The list of scoped permissions for registry artifacts. E.g. repositories/repository-name/content/read, repositories/repository-name/metadata/write. - :type actions: list[str] + :vartype actions: list[str] """ _validation = { @@ -3055,6 +3824,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. + :paramtype actions: list[str] + """ super(ScopeMap, self).__init__(**kwargs) self.description = description self.type_properties_type = None @@ -3066,11 +3843,11 @@ def __init__( class ScopeMapListResult(msrest.serialization.Model): """The result of a request to list scope maps for a container registry. - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field + :ivar value: The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :ivar next_link: The URI that can be used to request the next list of scope maps. + :vartype next_link: str """ _attribute_map = { @@ -3085,6 +3862,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of scope maps. Since this list may be incomplete, the nextLink field + should be used to request the next list of scope maps. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :keyword next_link: The URI that can be used to request the next list of scope maps. + :paramtype next_link: str + """ super(ScopeMapListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3093,12 +3877,12 @@ def __init__( class ScopeMapUpdateParameters(msrest.serialization.Model): """The properties for updating the scope map. - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. + :ivar description: The user friendly description of the scope map. + :vartype description: str + :ivar actions: The list of scope permissions for registry artifacts. E.g. repositories/repository-name/pull, repositories/repository-name/delete. - :type actions: list[str] + :vartype actions: list[str] """ _attribute_map = { @@ -3113,6 +3897,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scope permissions for registry artifacts. + E.g. repositories/repository-name/pull, + repositories/repository-name/delete. + :paramtype actions: list[str] + """ super(ScopeMapUpdateParameters, self).__init__(**kwargs) self.description = description self.actions = actions @@ -3125,9 +3917,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name of the container registry. Required for registry creation. + :ivar name: Required. The SKU name of the container registry. Required for registry creation. Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuName :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", "Standard", "Premium". :vartype tier: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuTier @@ -3149,6 +3941,11 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Possible values include: "Classic", "Basic", "Standard", "Premium". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -3157,11 +3954,11 @@ def __init__( class Source(msrest.serialization.Model): """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :param addr: The IP or hostname and the port of the registry node that generated the event. + :ivar addr: The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str """ _attribute_map = { @@ -3176,6 +3973,13 @@ def __init__( instance_id: Optional[str] = None, **kwargs ): + """ + :keyword addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :paramtype addr: str + :keyword instance_id: The running instance of an application. Changes after each restart. + :paramtype instance_id: str + """ super(Source, self).__init__(**kwargs) self.addr = addr self.instance_id = instance_id @@ -3210,6 +4014,8 @@ def __init__( self, **kwargs ): + """ + """ super(Status, self).__init__(**kwargs) self.display_status = None self.message = None @@ -3253,6 +4059,8 @@ def __init__( self, **kwargs ): + """ + """ super(StatusDetailProperties, self).__init__(**kwargs) self.type = None self.code = None @@ -3268,19 +4076,18 @@ class SyncProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param token_id: Required. The resource ID of the ACR token used to authenticate the connected + :ivar token_id: Required. The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. - :type token_id: str - :param schedule: The cron expression indicating the schedule that the connected registry will + :vartype token_id: str + :ivar schedule: The cron expression indicating the schedule that the connected registry will sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. + :vartype schedule: str + :ivar sync_window: The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: Required. The period of time for which a message is available to sync - before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per - ISO8601. - :type message_ttl: ~datetime.timedelta + :vartype sync_window: ~datetime.timedelta + :ivar message_ttl: Required. The period of time for which a message is available to sync before + it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :vartype message_ttl: ~datetime.timedelta :ivar last_sync_time: The last time a sync occurred between the connected registry and its parent. :vartype last_sync_time: ~datetime.datetime @@ -3314,6 +4121,21 @@ def __init__( sync_window: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword token_id: Required. The resource ID of the ACR token used to authenticate the + connected registry to its parent during sync. + :paramtype token_id: str + :keyword schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :paramtype schedule: str + :keyword sync_window: The time window during which sync is enabled for each schedule + occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype sync_window: ~datetime.timedelta + :keyword message_ttl: Required. The period of time for which a message is available to sync + before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per + ISO8601. + :paramtype message_ttl: ~datetime.timedelta + """ super(SyncProperties, self).__init__(**kwargs) self.token_id = token_id self.schedule = schedule @@ -3326,15 +4148,15 @@ def __init__( class SyncUpdateProperties(msrest.serialization.Model): """The parameters for updating the sync properties of the connected registry with its parent. - :param schedule: The cron expression indicating the schedule that the connected registry will + :ivar schedule: The cron expression indicating the schedule that the connected registry will sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. + :vartype schedule: str + :ivar sync_window: The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: The period of time for which a message is available to sync before it is + :vartype sync_window: ~datetime.timedelta + :ivar message_ttl: The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type message_ttl: ~datetime.timedelta + :vartype message_ttl: ~datetime.timedelta """ _attribute_map = { @@ -3351,6 +4173,17 @@ def __init__( message_ttl: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :paramtype schedule: str + :keyword sync_window: The time window during which sync is enabled for each schedule + occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype sync_window: ~datetime.timedelta + :keyword message_ttl: The period of time for which a message is available to sync before it is + expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype message_ttl: ~datetime.timedelta + """ super(SyncUpdateProperties, self).__init__(**kwargs) self.schedule = schedule self.sync_window = sync_window @@ -3360,22 +4193,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :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: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3398,6 +4231,24 @@ def __init__( 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". + :paramtype created_by_type: str or + ~azure.mgmt.containerregistry.v2021_06_01_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". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3410,24 +4261,24 @@ def __init__( class Target(msrest.serialization.Model): """The target of the event. - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: long + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: long + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str """ _attribute_map = { @@ -3456,6 +4307,27 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword media_type: The MIME type of the referenced object. + :paramtype media_type: str + :keyword size: The number of bytes of the content. Same as Length field. + :paramtype size: long + :keyword digest: The digest of the content, as defined by the Registry V2 HTTP API + Specification. + :paramtype digest: str + :keyword length: The number of bytes of the content. Same as Size field. + :paramtype length: long + :keyword repository: The repository name. + :paramtype repository: str + :keyword url: The direct URL to the content. + :paramtype url: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword name: The name of the artifact. + :paramtype name: str + :keyword version: The version of the artifact. + :paramtype version: str + """ super(Target, self).__init__(**kwargs) self.media_type = media_type self.size = size @@ -3493,6 +4365,8 @@ def __init__( self, **kwargs ): + """ + """ super(TlsCertificateProperties, self).__init__(**kwargs) self.type = None self.location = None @@ -3525,6 +4399,8 @@ def __init__( self, **kwargs ): + """ + """ super(TlsProperties, self).__init__(**kwargs) self.status = None self.certificate = None @@ -3549,15 +4425,15 @@ class Token(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype scope_map_id: str + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus """ _validation = { @@ -3589,6 +4465,17 @@ def __init__( status: Optional[Union[str, "TokenStatus"]] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + """ super(Token, self).__init__(**kwargs) self.creation_date = None self.provisioning_state = None @@ -3600,16 +4487,16 @@ def __init__( class TokenCertificate(msrest.serialization.Model): """The properties of a certificate used for authenticating a token. - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or + :ivar name: Possible values include: "certificate1", "certificate2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format + :ivar expiry: The expiry datetime of the certificate. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The thumbprint of the certificate. + :vartype thumbprint: str + :ivar encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - :type encoded_pem_certificate: str + :vartype encoded_pem_certificate: str """ _attribute_map = { @@ -3628,6 +4515,18 @@ def __init__( encoded_pem_certificate: Optional[str] = None, **kwargs ): + """ + :keyword name: Possible values include: "certificate1", "certificate2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificateName + :keyword expiry: The expiry datetime of the certificate. + :paramtype expiry: ~datetime.datetime + :keyword thumbprint: The thumbprint of the certificate. + :paramtype thumbprint: str + :keyword encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM + format that will be used for authenticating the token. + :paramtype encoded_pem_certificate: str + """ super(TokenCertificate, self).__init__(**kwargs) self.name = name self.expiry = expiry @@ -3638,11 +4537,12 @@ def __init__( class TokenCredentialsProperties(msrest.serialization.Model): """The properties of the credentials that can be used for authenticating the token. - :param certificates: - :type certificates: + :ivar certificates: + :vartype certificates: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + :ivar passwords: + :vartype passwords: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] """ _attribute_map = { @@ -3657,6 +4557,14 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword certificates: + :paramtype certificates: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificate] + :keyword passwords: + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + """ super(TokenCredentialsProperties, self).__init__(**kwargs) self.certificates = certificates self.passwords = passwords @@ -3665,11 +4573,11 @@ def __init__( class TokenListResult(msrest.serialization.Model): """The result of a request to list tokens for a container registry. - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should + :ivar value: The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :ivar next_link: The URI that can be used to request the next list of tokens. + :vartype next_link: str """ _attribute_map = { @@ -3684,6 +4592,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of tokens. Since this list may be incomplete, the nextLink field + should be used to request the next list of tokens. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :keyword next_link: The URI that can be used to request the next list of tokens. + :paramtype next_link: str + """ super(TokenListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3694,13 +4609,14 @@ class TokenPassword(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + :ivar creation_time: The creation datetime of the password. + :vartype creation_time: ~datetime.datetime + :ivar expiry: The expiry datetime of the password. + :vartype expiry: ~datetime.datetime + :ivar name: The password name "password1" or "password2". Possible values include: "password1", + "password2". + :vartype name: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName :ivar value: The password value. :vartype value: str """ @@ -3724,6 +4640,16 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword creation_time: The creation datetime of the password. + :paramtype creation_time: ~datetime.datetime + :keyword expiry: The expiry datetime of the password. + :paramtype expiry: ~datetime.datetime + :keyword name: The password name "password1" or "password2". Possible values include: + "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + """ super(TokenPassword, self).__init__(**kwargs) self.creation_time = creation_time self.expiry = expiry @@ -3734,14 +4660,14 @@ def __init__( class TokenUpdateParameters(msrest.serialization.Model): """The parameters for updating a token. - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: + :vartype scope_map_id: str + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties """ @@ -3759,6 +4685,17 @@ def __init__( credentials: Optional["TokenCredentialsProperties"] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties + """ super(TokenUpdateParameters, self).__init__(**kwargs) self.scope_map_id = scope_map_id self.status = status @@ -3768,12 +4705,12 @@ def __init__( class TrustPolicy(msrest.serialization.Model): """The content trust policy for a container registry. - :param type: The type of trust policy. Possible values include: "Notary". Default value: + :ivar type: The type of trust policy. Possible values include: "Notary". Default value: "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values + :vartype type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus """ _attribute_map = { @@ -3788,6 +4725,15 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicyType + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ super(TrustPolicy, self).__init__(**kwargs) self.type = type self.status = status @@ -3796,10 +4742,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -3814,6 +4760,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id @@ -3824,11 +4776,11 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar action: The action of virtual network rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str + :vartype virtual_network_resource_id: str """ _validation = { @@ -3847,6 +4799,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of virtual network rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.action = action self.virtual_network_resource_id = virtual_network_resource_id @@ -3865,22 +4824,22 @@ class Webhook(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] :ivar provisioning_state: The provisioning state of the webhook at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -3921,6 +4880,24 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + """ super(Webhook, self).__init__(location=location, tags=tags, **kwargs) self.status = status self.scope = scope @@ -3933,24 +4910,24 @@ class WebhookCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the webhook. This cannot be changed after the resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] """ @@ -3980,6 +4957,28 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + """ super(WebhookCreateParameters, self).__init__(**kwargs) self.tags = tags self.location = location @@ -3993,11 +4992,11 @@ def __init__( class WebhookListResult(msrest.serialization.Model): """The result of a request to list webhooks for a container registry. - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str + :ivar value: The list of webhooks. Since this list may be incomplete, the nextLink field should + be used to request the next list of webhooks. + :vartype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :ivar next_link: The URI that can be used to request the next list of webhooks. + :vartype next_link: str """ _attribute_map = { @@ -4012,6 +5011,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :keyword next_link: The URI that can be used to request the next list of webhooks. + :paramtype next_link: str + """ super(WebhookListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4020,21 +5026,21 @@ def __init__( class WebhookUpdateParameters(msrest.serialization.Model): """The parameters for updating a webhook. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] """ @@ -4058,6 +5064,25 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + """ super(WebhookUpdateParameters, self).__init__(**kwargs) self.tags = tags self.service_uri = service_uri diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py index 1ecd14f07fad..60b9dcd0b147 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py @@ -5,25 +5,270 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deactivate_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ConnectedRegistriesOperations(object): """ConnectedRegistriesOperations operations. @@ -47,14 +292,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> "_models.ConnectedRegistry": """Gets the properties of the connected registry. :param resource_group_name: The name of the resource group to which the container registry @@ -74,34 +319,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -110,56 +345,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_create_parameters, # type: "_models.ConnectedRegistry" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> "_models.ConnectedRegistry": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -171,17 +396,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_create_parameters, # type: "_models.ConnectedRegistry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConnectedRegistry"] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> LROPoller["_models.ConnectedRegistry"]: """Creates a connected registry for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -192,18 +419,24 @@ def begin_create( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,28 +449,21 @@ def begin_create( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_create_parameters=connected_registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -249,64 +475,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a connected registry from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -318,15 +534,17 @@ def begin_delete( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +559,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,56 +578,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> "_models.ConnectedRegistry": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -429,17 +628,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConnectedRegistry"] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.ConnectedRegistry"]: """Updates a connected registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -450,18 +651,24 @@ def begin_update( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryUpdateParameters + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,28 +681,21 @@ def begin_update( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_update_parameters=connected_registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -507,16 +707,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ConnectedRegistryListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ConnectedRegistryListResult"]: """Lists all connected registries for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -529,8 +730,10 @@ def list( connectedRegistry parent), mode, and connectionState. The supported operator is eq. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryListResult] + :return: An iterator like instance of either ConnectedRegistryListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] @@ -538,38 +741,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + deserialized = self._deserialize("ConnectedRegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,12 +782,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -595,60 +796,49 @@ def get_next(next_link=None): def _deactivate_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + @distributed_trace def begin_deactivate( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deactivates the connected registry instance. :param resource_group_name: The name of the resource group to which the container registry @@ -660,15 +850,17 @@ def begin_deactivate( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -683,22 +875,14 @@ def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -710,4 +894,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py index 6ae5a2b5c9ab..fc99d27f1a7a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExportPipelinesOperations(object): """ExportPipelinesOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> "_models.ExportPipeline": """Gets the properties of the export pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> "_models.ExportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExportPipeline"] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ExportPipeline"]: """Creates an export pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an export pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ExportPipelineListResult"]: """Lists all export pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py index 873e7e45dc1f..8252c03eea46 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ImportPipelinesOperations(object): """ImportPipelinesOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> "_models.ImportPipeline": """Gets the properties of the import pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> "_models.ImportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ImportPipeline"] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ImportPipeline"]: """Creates an import pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an import pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ImportPipelineListResult"]: """Lists all import pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_operations.py index 4be44674016c..c13719d09f66 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Container Registry REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py index 9cc4a79394fe..ac26011fb31f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PipelineRunsOperations(object): """PipelineRunsOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> "_models.PipelineRun": """Gets the detailed information for a given pipeline run. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> "_models.PipelineRun": cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PipelineRun"] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> LROPoller["_models.PipelineRun"]: """Creates a pipeline run for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +325,24 @@ def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +355,21 @@ def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +381,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +420,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a pipeline run from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +440,17 @@ def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +465,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,15 +484,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PipelineRunListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PipelineRunListResult"]: """Lists all the pipeline runs for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -380,8 +502,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -389,36 +513,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -436,6 +557,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py index 91c9bfaa3833..c53acdfb2586 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +251,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +302,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Update the state of specified private endpoint connection associated with the container registry. @@ -191,18 +326,24 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,28 +356,21 @@ def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,41 +382,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + 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', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -295,14 +421,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -314,15 +441,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -337,22 +466,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,15 +485,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all private endpoint connections in a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -381,8 +503,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -390,36 +514,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -437,6 +558,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py index f68cb8445c11..05684207b097 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py @@ -5,25 +5,519 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_import_image_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_credentials_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -49,41 +543,32 @@ def __init__(self, client, config, serializer, deserializer): def _import_image_initial( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,14 +581,15 @@ def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace def begin_import_image( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> LROPoller[None]: """Copies an image to this container registry from the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -113,18 +599,22 @@ def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -136,24 +626,18 @@ def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -165,20 +649,22 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace def check_name_availability( self, - registry_name_check_request, # type: "_models.RegistryNameCheckRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryNameStatus" + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": """Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameStatus @@ -189,30 +675,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,15 +702,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": """Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -252,27 +730,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,47 +754,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry, 'Registry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -344,16 +803,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -365,15 +826,19 @@ def begin_create( :type registry: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,27 +850,21 @@ def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -417,39 +876,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -462,13 +913,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -478,15 +930,17 @@ def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -500,21 +954,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -526,47 +973,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -584,16 +1021,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -602,18 +1041,23 @@ def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -625,27 +1069,21 @@ def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,14 +1095,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry @@ -672,7 +1111,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -680,35 +1120,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -726,21 +1162,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -748,34 +1186,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -793,18 +1226,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -822,27 +1256,17 @@ def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -856,16 +1280,18 @@ def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace def regenerate_credential( self, - resource_group_name, # type: str - registry_name, # type: str - regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -875,7 +1301,8 @@ def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListCredentialsResult @@ -886,32 +1313,22 @@ def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -925,15 +1342,17 @@ def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + @distributed_trace def list_usages( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryUsageListResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": """Gets the quota usages for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -951,27 +1370,17 @@ def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,15 +1394,17 @@ def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """Lists the private link resources for a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1002,8 +1413,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -1011,36 +1424,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1058,6 +1468,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1065,43 +1476,32 @@ def get_next(next_link=None): def _generate_credentials_initial( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> Optional["_models.GenerateCredentialsResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateCredentialsResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1117,16 +1517,18 @@ def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace def begin_generate_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> LROPoller["_models.GenerateCredentialsResult"]: """Generate keys for a token of a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1135,18 +1537,24 @@ def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1158,27 +1566,21 @@ def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1190,4 +1592,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py index 251e1a45b1c5..a4a8bd445e61 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReplicationsOperations(object): """ReplicationsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": """Gets the properties of the specified replication. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Creates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,20 @@ def begin_create( :type replication: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a replication from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Updates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,24 @@ def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +632,21 @@ def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +658,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationListResult"]: """Lists all the replications for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -518,8 +676,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -527,36 +687,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +731,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py index ad0ed1df560b..3da4ed8ee242 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ScopeMapsOperations(object): """ScopeMapsOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> "_models.ScopeMap": """Gets the properties of the specified scope map. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Creates a scope map for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +371,23 @@ def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +400,21 @@ def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +426,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +465,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a scope map from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +485,17 @@ def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +510,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +529,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +579,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Updates a scope map with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +602,23 @@ def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +631,21 @@ def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +657,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScopeMapListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ScopeMapListResult"]: """Lists all the scope maps for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +676,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -527,36 +685,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +729,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py index 59f379e24c17..b082546b993c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TokensOperations(object): """TokensOperations operations. @@ -47,14 +245,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> "_models.Token": """Gets the properties of the specified token. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +272,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +297,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_create_parameters, 'Token') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +348,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Creates a token for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -193,15 +374,19 @@ def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +399,21 @@ def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +425,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +464,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a token from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +484,17 @@ def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +509,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +528,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +578,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Updates a token with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +601,23 @@ def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +630,21 @@ def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +656,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TokenListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TokenListResult"]: """Lists all the tokens for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +675,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -527,36 +684,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,6 +728,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py index ef20e1ef9dd6..dce8bd312d7e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py @@ -5,25 +5,334 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_ping_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_callback_config_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_events_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebhooksOperations(object): """WebhooksOperations operations. @@ -47,14 +356,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": """Gets the properties of the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -74,28 +383,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,49 +408,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,17 +459,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Creates a webhook for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -190,18 +482,23 @@ def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +511,21 @@ def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,41 +537,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +576,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a webhook from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -313,15 +596,17 @@ def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,22 +621,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,49 +640,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -423,17 +690,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Updates a webhook with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -444,18 +713,23 @@ def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,28 +742,21 @@ def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,15 +768,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebhookListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.WebhookListResult"]: """Lists all the webhooks for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -519,7 +787,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -527,36 +796,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -574,19 +840,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace def ping( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventInfo" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": """Triggers a ping event to be sent to the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +873,18 @@ def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +898,18 @@ def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace def get_callback_config( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CallbackConfig" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": """Gets the configuration of service URI and custom headers for the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -670,28 +929,18 @@ def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -705,16 +954,18 @@ def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + @distributed_trace def list_events( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventListResult"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> Iterable["_models.EventListResult"]: """Lists recent events for the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -726,7 +977,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -734,37 +986,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -782,6 +1032,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/__init__.py index 0c85bb0c5d60..77e0de13a64c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerRegistryManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_configuration.py index 80d627e4095a..e9d90efb3bea 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerRegistryManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_container_registry_management_client.py index cb777b9d0dfb..8202de59fd3e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_container_registry_management_client.py @@ -6,124 +6,117 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations, ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, ScopeMapsOperations, TokensOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ConnectedRegistriesOperations -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import WebhooksOperations -from . import models - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar connected_registries: ConnectedRegistriesOperations operations - :vartype connected_registries: azure.mgmt.containerregistry.v2021_08_01_preview.operations.ConnectedRegistriesOperations + :vartype connected_registries: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.ConnectedRegistriesOperations :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2021_08_01_preview.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2021_08_01_preview.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2021_08_01_preview.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2021_08_01_preview.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2021_08_01_preview.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2021_08_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2021_08_01_preview.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.ReplicationsOperations :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2021_08_01_preview.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations :vartype tokens: azure.mgmt.containerregistry.v2021_08_01_preview.operations.TokensOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2021_08_01_preview.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2021_08_01_preview.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.connected_registries = ConnectedRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.connected_registries = ConnectedRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_metadata.json index 41688a71872b..39a0d58c60da 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerRegistryManagementClient", "filename": "_container_registry_management_client", "description": "ContainerRegistryManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "connected_registries": "ConnectedRegistriesOperations", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_version.py index d5f3055d6eb4..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/__init__.py index 3f69d67ba538..41dd7f11c046 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_registry_management_client import ContainerRegistryManagementClient __all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_configuration.py index 0b1de208cc56..ce65f9bc8cb7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_container_registry_management_client.py index 68218f01c1a0..e51223587bb7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_container_registry_management_client.py @@ -6,120 +6,118 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations, ExportPipelinesOperations, ImportPipelinesOperations, Operations, PipelineRunsOperations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, ScopeMapsOperations, TokensOperations, WebhooksOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import ConnectedRegistriesOperations -from .operations import ExportPipelinesOperations -from .operations import RegistriesOperations -from .operations import ImportPipelinesOperations -from .operations import Operations -from .operations import PipelineRunsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import ReplicationsOperations -from .operations import ScopeMapsOperations -from .operations import TokensOperations -from .operations import WebhooksOperations -from .. import models - - -class ContainerRegistryManagementClient(object): +class ContainerRegistryManagementClient: """ContainerRegistryManagementClient. :ivar connected_registries: ConnectedRegistriesOperations operations - :vartype connected_registries: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ConnectedRegistriesOperations + :vartype connected_registries: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ConnectedRegistriesOperations :ivar export_pipelines: ExportPipelinesOperations operations - :vartype export_pipelines: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ExportPipelinesOperations + :vartype export_pipelines: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ExportPipelinesOperations :ivar registries: RegistriesOperations operations - :vartype registries: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.RegistriesOperations + :vartype registries: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.RegistriesOperations :ivar import_pipelines: ImportPipelinesOperations operations - :vartype import_pipelines: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ImportPipelinesOperations + :vartype import_pipelines: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ImportPipelinesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.Operations :ivar pipeline_runs: PipelineRunsOperations operations - :vartype pipeline_runs: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.PipelineRunsOperations + :vartype pipeline_runs: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.PipelineRunsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar replications: ReplicationsOperations operations - :vartype replications: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ReplicationsOperations + :vartype replications: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ReplicationsOperations :ivar scope_maps: ScopeMapsOperations operations - :vartype scope_maps: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ScopeMapsOperations + :vartype scope_maps: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.ScopeMapsOperations :ivar tokens: TokensOperations operations - :vartype tokens: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.TokensOperations + :vartype tokens: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.TokensOperations :ivar webhooks: WebhooksOperations operations - :vartype webhooks: azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.WebhooksOperations + :vartype webhooks: + azure.mgmt.containerregistry.v2021_08_01_preview.aio.operations.WebhooksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.connected_registries = ConnectedRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations(self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + - self.connected_registries = ConnectedRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.export_pipelines = ExportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.import_pipelines = ImportPipelinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.pipeline_runs = PipelineRunsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replications = ReplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scope_maps = ScopeMapsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tokens = TokensOperations( - self._client, self._config, self._serialize, self._deserialize) - self.webhooks = WebhooksOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_connected_registries_operations.py index 82d8ec70eaa7..591aca8e5084 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_connected_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._connected_registries_operations import build_create_request_initial, build_deactivate_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -62,8 +68,10 @@ def list( connectedRegistry parent), mode, and connectionState. The supported operator is eq. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryListResult] + :return: An iterator like instance of either ConnectedRegistryListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] @@ -71,38 +79,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + deserialized = self._deserialize("ConnectedRegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +120,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -152,34 +159,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -188,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -203,40 +202,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -248,8 +236,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -268,18 +259,24 @@ async def begin_create( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +289,21 @@ async def begin_create( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_create_parameters=connected_registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -325,6 +315,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore async def _delete_initial( @@ -339,41 +330,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -392,15 +374,17 @@ async def begin_delete( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,22 +399,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -442,6 +418,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore async def _update_initial( @@ -457,40 +434,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -502,8 +468,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -522,18 +491,24 @@ async def begin_update( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryUpdateParameters + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -546,28 +521,21 @@ async def begin_update( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_update_parameters=connected_registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -579,6 +547,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore async def _deactivate_initial( @@ -593,41 +562,32 @@ async def _deactivate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + @distributed_trace_async async def begin_deactivate( self, resource_group_name: str, @@ -646,15 +606,17 @@ async def begin_deactivate( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -669,22 +631,14 @@ async def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -696,4 +650,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_export_pipelines_operations.py index 2d1e5225a514..53b619232c28 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_export_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._export_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +193,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +227,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -258,18 +250,24 @@ async def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +280,21 @@ async def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore async def _delete_initial( @@ -329,26 +321,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +345,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +365,17 @@ async def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +390,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,4 +409,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_import_pipelines_operations.py index 28c80bac38ab..984ee6e84844 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_import_pipelines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._import_pipelines_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +193,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +227,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -258,18 +250,24 @@ async def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +280,21 @@ async def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore async def _delete_initial( @@ -329,26 +321,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +345,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +365,17 @@ async def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +390,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,4 +409,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_operations.py index 1a2b6e75e09c..fe50efd64ed5 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_pipeline_runs_operations.py index d6c4c5fa591f..faa237d44acd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_pipeline_runs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._pipeline_runs_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +193,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +227,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -258,18 +250,24 @@ async def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +280,21 @@ async def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore async def _delete_initial( @@ -329,26 +321,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +345,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +365,17 @@ async def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +390,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,4 +409,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_private_endpoint_connections_operations.py index ef2dcf76ea2b..530b1f32a7ad 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -194,33 +193,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +227,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -259,18 +251,24 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +281,21 @@ async def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +307,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -330,26 +322,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -362,6 +346,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -380,15 +366,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +391,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -430,4 +410,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_registries_operations.py index e6733eeab4dd..7a65479ee1a3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_registries_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_generate_credentials_request_initial, build_get_request, build_import_image_request_initial, build_list_by_resource_group_request, build_list_credentials_request, build_list_private_link_resources_request, build_list_request, build_list_usages_request, build_regenerate_credential_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,30 +60,22 @@ async def _import_image_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImportImageParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -91,6 +88,8 @@ async def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace_async async def begin_import_image( self, resource_group_name: str, @@ -107,18 +106,22 @@ async def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -130,24 +133,18 @@ async def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -159,8 +156,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace_async async def check_name_availability( self, registry_name_check_request: "_models.RegistryNameCheckRequest", @@ -171,7 +170,8 @@ async def check_name_availability( :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryNameStatus @@ -182,30 +182,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,8 +209,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -229,7 +222,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -237,34 +231,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -282,11 +271,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -299,7 +290,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -307,35 +299,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -353,11 +341,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -381,27 +371,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,8 +395,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -429,32 +411,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -472,8 +444,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -492,15 +467,20 @@ async def begin_create( :type registry: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -512,27 +492,21 @@ async def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -544,6 +518,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _delete_initial( @@ -557,25 +532,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -588,6 +555,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -603,15 +572,17 @@ async def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -625,21 +596,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -651,6 +615,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore async def _update_initial( @@ -665,32 +630,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -708,8 +663,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -725,18 +683,24 @@ async def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -748,27 +712,21 @@ async def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -780,8 +738,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace_async async def list_usages( self, resource_group_name: str, @@ -805,27 +765,17 @@ async def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,8 +789,11 @@ async def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, resource_group_name: str, @@ -855,8 +808,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -864,36 +819,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -911,11 +863,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def list_credentials( self, resource_group_name: str, @@ -939,27 +893,17 @@ async def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -973,8 +917,11 @@ async def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace_async async def regenerate_credential( self, resource_group_name: str, @@ -991,7 +938,8 @@ async def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListCredentialsResult @@ -1002,32 +950,22 @@ async def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1041,8 +979,10 @@ async def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + async def _generate_credentials_initial( self, resource_group_name: str, @@ -1055,32 +995,22 @@ async def _generate_credentials_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') + + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1096,8 +1026,11 @@ async def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace_async async def begin_generate_credentials( self, resource_group_name: str, @@ -1113,18 +1046,24 @@ async def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1136,27 +1075,21 @@ async def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1168,4 +1101,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_replications_operations.py index ef758da6fa86..2dbac470eb79 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_replications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._replications_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +193,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication, 'Replication') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +227,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,15 +253,20 @@ async def begin_create( :type replication: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +279,21 @@ async def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _delete_initial( @@ -329,26 +320,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +344,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +364,17 @@ async def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +389,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +408,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore async def _update_initial( @@ -444,33 +424,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,8 +458,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -508,18 +481,24 @@ async def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -532,28 +511,21 @@ async def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -565,4 +537,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_scope_maps_operations.py index ae5fa8325447..43013fc57758 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_scope_maps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._scope_maps_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +150,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +175,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +192,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +226,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -258,18 +249,24 @@ async def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +279,21 @@ async def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _delete_initial( @@ -329,26 +320,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +344,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +364,17 @@ async def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +389,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +408,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore async def _update_initial( @@ -444,33 +424,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,8 +458,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -508,18 +481,24 @@ async def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -532,28 +511,21 @@ async def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -565,4 +537,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_tokens_operations.py index fc2b272cafb9..dceeb61d22aa 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_tokens_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tokens_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +150,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +175,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +192,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_create_parameters, 'Token') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +226,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,15 +252,19 @@ async def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +277,21 @@ async def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _delete_initial( @@ -329,26 +318,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +342,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +362,17 @@ async def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +406,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore async def _update_initial( @@ -444,33 +422,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,8 +456,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -508,18 +479,23 @@ async def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -532,28 +508,21 @@ async def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -565,4 +534,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_webhooks_operations.py index ea65a3c707f8..a7bb27c23980 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/aio/operations/_webhooks_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._webhooks_operations import build_create_request_initial, build_delete_request_initial, build_get_callback_config_request, build_get_request, build_list_events_request, build_list_request, build_ping_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,7 +64,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -66,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +150,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +175,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -194,33 +192,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,8 +226,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -258,18 +249,24 @@ async def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,28 +279,21 @@ async def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -315,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _delete_initial( @@ -329,26 +320,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,6 +344,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -379,15 +364,17 @@ async def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -402,22 +389,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +408,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore async def _update_initial( @@ -444,33 +424,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,8 +458,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -508,18 +481,24 @@ async def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -532,28 +511,21 @@ async def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -565,8 +537,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace_async async def ping( self, resource_group_name: str, @@ -593,28 +567,18 @@ async def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +592,11 @@ async def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace def list_events( self, resource_group_name: str, @@ -648,7 +615,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -656,37 +624,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -704,11 +670,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_events.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'} # type: ignore + @distributed_trace_async async def get_callback_config( self, resource_group_name: str, @@ -735,28 +703,18 @@ async def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -770,4 +728,6 @@ async def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/__init__.py index 1a70164b9beb..51c980de1cff 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/__init__.py @@ -6,216 +6,111 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActivationProperties - from ._models_py3 import ActiveDirectoryObject - from ._models_py3 import Actor - from ._models_py3 import CallbackConfig - from ._models_py3 import ConnectedRegistry - from ._models_py3 import ConnectedRegistryListResult - from ._models_py3 import ConnectedRegistryUpdateParameters - from ._models_py3 import EncryptionProperty - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import Event - from ._models_py3 import EventContent - from ._models_py3 import EventInfo - from ._models_py3 import EventListResult - from ._models_py3 import EventRequestMessage - from ._models_py3 import EventResponseMessage - from ._models_py3 import ExportPipeline - from ._models_py3 import ExportPipelineListResult - from ._models_py3 import ExportPipelineTargetProperties - from ._models_py3 import ExportPolicy - from ._models_py3 import GenerateCredentialsParameters - from ._models_py3 import GenerateCredentialsResult - from ._models_py3 import IPRule - from ._models_py3 import IdentityProperties - from ._models_py3 import ImportImageParameters - from ._models_py3 import ImportPipeline - from ._models_py3 import ImportPipelineListResult - from ._models_py3 import ImportPipelineSourceProperties - from ._models_py3 import ImportSource - from ._models_py3 import ImportSourceCredentials - from ._models_py3 import InnerErrorDescription - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LoggingProperties - from ._models_py3 import LoginServerProperties - from ._models_py3 import NetworkRuleSet - from ._models_py3 import OperationDefinition - from ._models_py3 import OperationDisplayDefinition - from ._models_py3 import OperationListResult - from ._models_py3 import OperationLogSpecificationDefinition - from ._models_py3 import OperationMetricSpecificationDefinition - from ._models_py3 import OperationServiceSpecificationDefinition - from ._models_py3 import ParentProperties - from ._models_py3 import PipelineRun - from ._models_py3 import PipelineRunListResult - from ._models_py3 import PipelineRunRequest - from ._models_py3 import PipelineRunResponse - from ._models_py3 import PipelineRunSourceProperties - from ._models_py3 import PipelineRunTargetProperties - from ._models_py3 import PipelineSourceTriggerDescriptor - from ._models_py3 import PipelineSourceTriggerProperties - from ._models_py3 import PipelineTriggerDescriptor - from ._models_py3 import PipelineTriggerProperties - from ._models_py3 import Policies - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProgressProperties - from ._models_py3 import ProxyResource - from ._models_py3 import QuarantinePolicy - from ._models_py3 import RegenerateCredentialParameters - from ._models_py3 import Registry - from ._models_py3 import RegistryListCredentialsResult - from ._models_py3 import RegistryListResult - from ._models_py3 import RegistryNameCheckRequest - from ._models_py3 import RegistryNameStatus - from ._models_py3 import RegistryPassword - from ._models_py3 import RegistryUpdateParameters - from ._models_py3 import RegistryUsage - from ._models_py3 import RegistryUsageListResult - from ._models_py3 import Replication - from ._models_py3 import ReplicationListResult - from ._models_py3 import ReplicationUpdateParameters - from ._models_py3 import Request - from ._models_py3 import Resource - from ._models_py3 import RetentionPolicy - from ._models_py3 import ScopeMap - from ._models_py3 import ScopeMapListResult - from ._models_py3 import ScopeMapUpdateParameters - from ._models_py3 import Sku - from ._models_py3 import Source - from ._models_py3 import Status - from ._models_py3 import StatusDetailProperties - from ._models_py3 import SyncProperties - from ._models_py3 import SyncUpdateProperties - from ._models_py3 import SystemData - from ._models_py3 import Target - from ._models_py3 import TlsCertificateProperties - from ._models_py3 import TlsProperties - from ._models_py3 import Token - from ._models_py3 import TokenCertificate - from ._models_py3 import TokenCredentialsProperties - from ._models_py3 import TokenListResult - from ._models_py3 import TokenPassword - from ._models_py3 import TokenUpdateParameters - from ._models_py3 import TrustPolicy - from ._models_py3 import UserIdentityProperties - from ._models_py3 import VirtualNetworkRule - from ._models_py3 import Webhook - from ._models_py3 import WebhookCreateParameters - from ._models_py3 import WebhookListResult - from ._models_py3 import WebhookUpdateParameters -except (SyntaxError, ImportError): - from ._models import ActivationProperties # type: ignore - from ._models import ActiveDirectoryObject # type: ignore - from ._models import Actor # type: ignore - from ._models import CallbackConfig # type: ignore - from ._models import ConnectedRegistry # type: ignore - from ._models import ConnectedRegistryListResult # type: ignore - from ._models import ConnectedRegistryUpdateParameters # type: ignore - from ._models import EncryptionProperty # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import Event # type: ignore - from ._models import EventContent # type: ignore - from ._models import EventInfo # type: ignore - from ._models import EventListResult # type: ignore - from ._models import EventRequestMessage # type: ignore - from ._models import EventResponseMessage # type: ignore - from ._models import ExportPipeline # type: ignore - from ._models import ExportPipelineListResult # type: ignore - from ._models import ExportPipelineTargetProperties # type: ignore - from ._models import ExportPolicy # type: ignore - from ._models import GenerateCredentialsParameters # type: ignore - from ._models import GenerateCredentialsResult # type: ignore - from ._models import IPRule # type: ignore - from ._models import IdentityProperties # type: ignore - from ._models import ImportImageParameters # type: ignore - from ._models import ImportPipeline # type: ignore - from ._models import ImportPipelineListResult # type: ignore - from ._models import ImportPipelineSourceProperties # type: ignore - from ._models import ImportSource # type: ignore - from ._models import ImportSourceCredentials # type: ignore - from ._models import InnerErrorDescription # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LoggingProperties # type: ignore - from ._models import LoginServerProperties # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import OperationDefinition # type: ignore - from ._models import OperationDisplayDefinition # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationLogSpecificationDefinition # type: ignore - from ._models import OperationMetricSpecificationDefinition # type: ignore - from ._models import OperationServiceSpecificationDefinition # type: ignore - from ._models import ParentProperties # type: ignore - from ._models import PipelineRun # type: ignore - from ._models import PipelineRunListResult # type: ignore - from ._models import PipelineRunRequest # type: ignore - from ._models import PipelineRunResponse # type: ignore - from ._models import PipelineRunSourceProperties # type: ignore - from ._models import PipelineRunTargetProperties # type: ignore - from ._models import PipelineSourceTriggerDescriptor # type: ignore - from ._models import PipelineSourceTriggerProperties # type: ignore - from ._models import PipelineTriggerDescriptor # type: ignore - from ._models import PipelineTriggerProperties # type: ignore - from ._models import Policies # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProgressProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QuarantinePolicy # type: ignore - from ._models import RegenerateCredentialParameters # type: ignore - from ._models import Registry # type: ignore - from ._models import RegistryListCredentialsResult # type: ignore - from ._models import RegistryListResult # type: ignore - from ._models import RegistryNameCheckRequest # type: ignore - from ._models import RegistryNameStatus # type: ignore - from ._models import RegistryPassword # type: ignore - from ._models import RegistryUpdateParameters # type: ignore - from ._models import RegistryUsage # type: ignore - from ._models import RegistryUsageListResult # type: ignore - from ._models import Replication # type: ignore - from ._models import ReplicationListResult # type: ignore - from ._models import ReplicationUpdateParameters # type: ignore - from ._models import Request # type: ignore - from ._models import Resource # type: ignore - from ._models import RetentionPolicy # type: ignore - from ._models import ScopeMap # type: ignore - from ._models import ScopeMapListResult # type: ignore - from ._models import ScopeMapUpdateParameters # type: ignore - from ._models import Sku # type: ignore - from ._models import Source # type: ignore - from ._models import Status # type: ignore - from ._models import StatusDetailProperties # type: ignore - from ._models import SyncProperties # type: ignore - from ._models import SyncUpdateProperties # type: ignore - from ._models import SystemData # type: ignore - from ._models import Target # type: ignore - from ._models import TlsCertificateProperties # type: ignore - from ._models import TlsProperties # type: ignore - from ._models import Token # type: ignore - from ._models import TokenCertificate # type: ignore - from ._models import TokenCredentialsProperties # type: ignore - from ._models import TokenListResult # type: ignore - from ._models import TokenPassword # type: ignore - from ._models import TokenUpdateParameters # type: ignore - from ._models import TrustPolicy # type: ignore - from ._models import UserIdentityProperties # type: ignore - from ._models import VirtualNetworkRule # type: ignore - from ._models import Webhook # type: ignore - from ._models import WebhookCreateParameters # type: ignore - from ._models import WebhookListResult # type: ignore - from ._models import WebhookUpdateParameters # type: ignore +from ._models_py3 import ActivationProperties +from ._models_py3 import ActiveDirectoryObject +from ._models_py3 import Actor +from ._models_py3 import CallbackConfig +from ._models_py3 import ConnectedRegistry +from ._models_py3 import ConnectedRegistryListResult +from ._models_py3 import ConnectedRegistryUpdateParameters +from ._models_py3 import EncryptionProperty +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import Event +from ._models_py3 import EventContent +from ._models_py3 import EventInfo +from ._models_py3 import EventListResult +from ._models_py3 import EventRequestMessage +from ._models_py3 import EventResponseMessage +from ._models_py3 import ExportPipeline +from ._models_py3 import ExportPipelineListResult +from ._models_py3 import ExportPipelineTargetProperties +from ._models_py3 import ExportPolicy +from ._models_py3 import GenerateCredentialsParameters +from ._models_py3 import GenerateCredentialsResult +from ._models_py3 import IPRule +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportImageParameters +from ._models_py3 import ImportPipeline +from ._models_py3 import ImportPipelineListResult +from ._models_py3 import ImportPipelineSourceProperties +from ._models_py3 import ImportSource +from ._models_py3 import ImportSourceCredentials +from ._models_py3 import InnerErrorDescription +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LoggingProperties +from ._models_py3 import LoginServerProperties +from ._models_py3 import NetworkRuleSet +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import OperationLogSpecificationDefinition +from ._models_py3 import OperationMetricSpecificationDefinition +from ._models_py3 import OperationServiceSpecificationDefinition +from ._models_py3 import ParentProperties +from ._models_py3 import PipelineRun +from ._models_py3 import PipelineRunListResult +from ._models_py3 import PipelineRunRequest +from ._models_py3 import PipelineRunResponse +from ._models_py3 import PipelineRunSourceProperties +from ._models_py3 import PipelineRunTargetProperties +from ._models_py3 import PipelineSourceTriggerDescriptor +from ._models_py3 import PipelineSourceTriggerProperties +from ._models_py3 import PipelineTriggerDescriptor +from ._models_py3 import PipelineTriggerProperties +from ._models_py3 import Policies +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProgressProperties +from ._models_py3 import ProxyResource +from ._models_py3 import QuarantinePolicy +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import RegistryUsage +from ._models_py3 import RegistryUsageListResult +from ._models_py3 import Replication +from ._models_py3 import ReplicationListResult +from ._models_py3 import ReplicationUpdateParameters +from ._models_py3 import Request +from ._models_py3 import Resource +from ._models_py3 import RetentionPolicy +from ._models_py3 import ScopeMap +from ._models_py3 import ScopeMapListResult +from ._models_py3 import ScopeMapUpdateParameters +from ._models_py3 import Sku +from ._models_py3 import Source +from ._models_py3 import Status +from ._models_py3 import StatusDetailProperties +from ._models_py3 import SyncProperties +from ._models_py3 import SyncUpdateProperties +from ._models_py3 import SystemData +from ._models_py3 import Target +from ._models_py3 import TlsCertificateProperties +from ._models_py3 import TlsProperties +from ._models_py3 import Token +from ._models_py3 import TokenCertificate +from ._models_py3 import TokenCredentialsProperties +from ._models_py3 import TokenListResult +from ._models_py3 import TokenPassword +from ._models_py3 import TokenUpdateParameters +from ._models_py3 import TrustPolicy +from ._models_py3 import UserIdentityProperties +from ._models_py3 import VirtualNetworkRule +from ._models_py3 import Webhook +from ._models_py3 import WebhookCreateParameters +from ._models_py3 import WebhookListResult +from ._models_py3 import WebhookUpdateParameters + from ._container_registry_management_client_enums import ( Action, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_container_registry_management_client_enums.py index a6116417eb16..0c0448c6db6f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_container_registry_management_client_enums.py @@ -6,60 +6,45 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Action(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action of virtual network rule. """ ALLOW = "Allow" -class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" RECREATE = "Recreate" -class ActivationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActivationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The activation status of the connected registry. """ ACTIVE = "Active" INACTIVE = "Inactive" -class AuditLogStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuditLogStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether audit logs are enabled on the connected registry. """ ENABLED = "Enabled" DISABLED = "Disabled" -class CertificateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of certificate location. """ LOCAL_DIRECTORY = "LocalDirectory" -class ConnectedRegistryMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectedRegistryMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The mode of the connected registry resource that indicates the permissions of the registry. """ @@ -68,7 +53,7 @@ class ConnectedRegistryMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REGISTRY = "Registry" MIRROR = "Mirror" -class ConnectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current connection state of the connected registry. """ @@ -77,7 +62,7 @@ class ConnectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYNCING = "Syncing" UNHEALTHY = "Unhealthy" -class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private link service connection status. """ @@ -86,7 +71,7 @@ class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -95,28 +80,28 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action of allow or deny when no other rules match. """ ALLOW = "Allow" DENY = "Deny" -class EncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether or not the encryption is enabled for container registry. """ ENABLED = "enabled" DISABLED = "disabled" -class ExportPolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExportPolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImportMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. """ @@ -124,7 +109,7 @@ class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NO_FORCE = "NoForce" FORCE = "Force" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -133,7 +118,7 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The verbosity of logs persisted on the connected registry. """ @@ -143,53 +128,53 @@ class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ERROR = "Error" NONE = "None" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to allow trusted Azure services to access a network restricted registry. """ AZURE_SERVICES = "AzureServices" NONE = "None" -class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name. """ PASSWORD = "password" PASSWORD2 = "password2" -class PipelineOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OVERWRITE_TAGS = "OverwriteTags" OVERWRITE_BLOBS = "OverwriteBlobs" DELETE_SOURCE_BLOB_ON_SUCCESS = "DeleteSourceBlobOnSuccess" CONTINUE_ON_ERRORS = "ContinueOnErrors" -class PipelineRunSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the source. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineRunTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineRunTargetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the target. """ AZURE_STORAGE_BLOB = "AzureStorageBlob" -class PipelineSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PipelineSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of source for the import pipeline. """ AZURE_STORAGE_BLOB_CONTAINER = "AzureStorageBlobContainer" -class PolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The value that indicates whether the policy is enabled or not. """ ENABLED = "enabled" DISABLED = "disabled" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the resource. """ @@ -200,21 +185,21 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not public network access is allowed for the container registry. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RegistryUsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegistryUsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement. """ COUNT = "Count" BYTES = "Bytes" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The identity type. """ @@ -223,7 +208,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU name of the container registry. Required for registry creation. """ @@ -232,7 +217,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier based on the SKU name. """ @@ -241,46 +226,46 @@ class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class TlsStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TlsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether HTTPS is enabled for the login server. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TokenCertificateName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenCertificateName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CERTIFICATE1 = "certificate1" CERTIFICATE2 = "certificate2" -class TokenPasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenPasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The password name "password1" or "password2" """ PASSWORD1 = "password1" PASSWORD2 = "password2" -class TokenStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TokenStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the token example enabled or disabled. """ ENABLED = "enabled" DISABLED = "disabled" -class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the source trigger. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TrustPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrustPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of trust policy. """ NOTARY = "Notary" -class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PUSH = "push" DELETE = "delete" @@ -288,14 +273,14 @@ class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CHART_PUSH = "chart_push" CHART_DELETE = "chart_delete" -class WebhookStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebhookStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the webhook at the time the operation was called. """ ENABLED = "enabled" DISABLED = "disabled" -class ZoneRedundancy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ZoneRedundancy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not zone redundancy is enabled for this container registry """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models.py deleted file mode 100644 index be602492fa7e..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models.py +++ /dev/null @@ -1,3676 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ActivationProperties(msrest.serialization.Model): - """The activation properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The activation status of the connected registry. Possible values include: - "Active", "Inactive". - :vartype status: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ActivationStatus - """ - - _validation = { - 'status': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActivationProperties, self).__init__(**kwargs) - self.status = None - - -class ActiveDirectoryObject(msrest.serialization.Model): - """The Active Directory Object that will be used for authenticating the token of a container registry. - - :param object_id: The user/group/application object ID for Active Directory Object that will be - used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that - will be used for authenticating the token of a container registry. - :type tenant_id: str - """ - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectoryObject, self).__init__(**kwargs) - self.object_id = kwargs.get('object_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - - -class Actor(msrest.serialization.Model): - """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - - :param name: The subject or username associated with the request context that generated the - event. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Actor, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class CallbackConfig(msrest.serialization.Model): - """The configuration of service URI and custom headers for the webhook. - - All required parameters must be populated in order to send to Azure. - - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - """ - - _validation = { - 'service_uri': {'required': True}, - } - - _attribute_map = { - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(CallbackConfig, self).__init__(**kwargs) - self.service_uri = kwargs['service_uri'] - self.custom_headers = kwargs.get('custom_headers', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ConnectedRegistry(ProxyResource): - """An object that represents a connected registry for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param mode: The mode of the connected registry resource that indicates the permissions of the - registry. Possible values include: "ReadWrite", "ReadOnly", "Registry", "Mirror". - :type mode: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryMode - :ivar version: The current version of ACR runtime on the connected registry. - :vartype version: str - :ivar connection_state: The current connection state of the connected registry. Possible values - include: "Online", "Offline", "Syncing", "Unhealthy". - :vartype connection_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectionState - :ivar last_activity_time: The last activity time of the connected registry. - :vartype last_activity_time: ~datetime.datetime - :ivar activation: The activation properties of the connected registry. - :vartype activation: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ActivationProperties - :param parent: The parent of the connected registry. - :type parent: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ParentProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :type client_token_ids: list[str] - :param login_server: The login server properties of the connected registry. - :type login_server: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoginServerProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties - :ivar status_details: The list of current statuses of the connected registry. - :vartype status_details: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.StatusDetailProperties] - :param notifications_list: The list of notifications subscription information for the connected - registry. - :type notifications_list: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'connection_state': {'readonly': True}, - 'last_activity_time': {'readonly': True}, - 'activation': {'readonly': True}, - 'status_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'connection_state': {'key': 'properties.connectionState', 'type': 'str'}, - 'last_activity_time': {'key': 'properties.lastActivityTime', 'type': 'iso-8601'}, - 'activation': {'key': 'properties.activation', 'type': 'ActivationProperties'}, - 'parent': {'key': 'properties.parent', 'type': 'ParentProperties'}, - 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'LoginServerProperties'}, - 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, - 'status_details': {'key': 'properties.statusDetails', 'type': '[StatusDetailProperties]'}, - 'notifications_list': {'key': 'properties.notificationsList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistry, self).__init__(**kwargs) - self.provisioning_state = None - self.mode = kwargs.get('mode', None) - self.version = None - self.connection_state = None - self.last_activity_time = None - self.activation = None - self.parent = kwargs.get('parent', None) - self.client_token_ids = kwargs.get('client_token_ids', None) - self.login_server = kwargs.get('login_server', None) - self.logging = kwargs.get('logging', None) - self.status_details = None - self.notifications_list = kwargs.get('notifications_list', None) - - -class ConnectedRegistryListResult(msrest.serialization.Model): - """The result of a request to list connected registries for a container registry. - - :param value: The list of connected registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of connected registries. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] - :param next_link: The URI that can be used to request the next list of connected registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ConnectedRegistry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ConnectedRegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a connected registry. - - :param sync_properties: The sync properties of the connected registry with its parent. - :type sync_properties: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SyncUpdateProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :type client_token_ids: list[str] - :param notifications_list: The list of notifications subscription information for the connected - registry. - :type notifications_list: list[str] - """ - - _attribute_map = { - 'sync_properties': {'key': 'properties.syncProperties', 'type': 'SyncUpdateProperties'}, - 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, - 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, - 'notifications_list': {'key': 'properties.notificationsList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) - self.sync_properties = kwargs.get('sync_properties', None) - self.logging = kwargs.get('logging', None) - self.client_token_ids = kwargs.get('client_token_ids', None) - self.notifications_list = kwargs.get('notifications_list', None) - - -class EncryptionProperty(msrest.serialization.Model): - """EncryptionProperty. - - :param status: Indicates whether or not the encryption is enabled for container registry. - Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.KeyVaultProperties - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProperty, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """An error response from the Azure Container Registry service. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this - contract. - :type details: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.InnerErrorDescription - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class EventInfo(msrest.serialization.Model): - """The basic information of an event. - - :param id: The event ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventInfo, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Event(EventInfo): - """The event for a webhook. - - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventResponseMessage - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, - 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.event_request_message = kwargs.get('event_request_message', None) - self.event_response_message = kwargs.get('event_response_message', None) - - -class EventContent(msrest.serialization.Model): - """The content of the event request message. - - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the - authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor - initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Source - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'action': {'key': 'action', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'Target'}, - 'request': {'key': 'request', 'type': 'Request'}, - 'actor': {'key': 'actor', 'type': 'Actor'}, - 'source': {'key': 'source', 'type': 'Source'}, - } - - def __init__( - self, - **kwargs - ): - super(EventContent, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.timestamp = kwargs.get('timestamp', None) - self.action = kwargs.get('action', None) - self.target = kwargs.get('target', None) - self.request = kwargs.get('request', None) - self.actor = kwargs.get('actor', None) - self.source = kwargs.get('source', None) - - -class EventListResult(msrest.serialization.Model): - """The result of a request to list events for a webhook. - - :param value: The list of events. Since this list may be incomplete, the nextLink field should - be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Event]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventRequestMessage(msrest.serialization.Model): - """The event request message sent to the service URI. - - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'EventContent'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'method': {'key': 'method', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventRequestMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.method = kwargs.get('method', None) - self.request_uri = kwargs.get('request_uri', None) - self.version = kwargs.get('version', None) - - -class EventResponseMessage(msrest.serialization.Model): - """The event response message received from the service URI. - - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventResponseMessage, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - self.headers = kwargs.get('headers', None) - self.reason_phrase = kwargs.get('reason_phrase', None) - self.status_code = kwargs.get('status_code', None) - self.version = kwargs.get('version', None) - - -class ExportPipeline(ProxyResource): - """An object that represents an export pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'target': {'key': 'properties.target', 'type': 'ExportPipelineTargetProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.target = kwargs.get('target', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ExportPipelineListResult(msrest.serialization.Model): - """The result of a request to list export pipelines for a container registry. - - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExportPipelineTargetProperties(msrest.serialization.Model): - """The properties of the export pipeline target. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPipelineTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class ExportPolicy(msrest.serialization.Model): - """The export policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". Default value: "enabled". - :type status: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', "enabled") - - -class GenerateCredentialsParameters(msrest.serialization.Model): - """The parameters used to generate credentials for a specified token or user of a container registry. - - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become - invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or - password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName - """ - - _attribute_map = { - 'token_id': {'key': 'tokenId', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsParameters, self).__init__(**kwargs) - self.token_id = kwargs.get('token_id', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - - -class GenerateCredentialsResult(msrest.serialization.Model): - """The response from the GenerateCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class IdentityProperties(msrest.serialization.Model): - """Managed identity for the resource. - - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", "None". - :type type: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity - dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.UserIdentityProperties] - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ImportImageParameters(msrest.serialization.Model): - """ImportImageParameters. - - All required parameters must be populated in order to send to Azure. - - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will - be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only - copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any - existing target tags will fail the operation before any copying begins. Possible values - include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportMode - """ - - _validation = { - 'source': {'required': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'ImportSource'}, - 'target_tags': {'key': 'targetTags', 'type': '[str]'}, - 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportImageParameters, self).__init__(**kwargs) - self.source = kwargs['source'] - self.target_tags = kwargs.get('target_tags', None) - self.untagged_target_repositories = kwargs.get('untagged_target_repositories', None) - self.mode = kwargs.get('mode', "NoForce") - - -class ImportPipeline(ProxyResource): - """An object that represents an import pipeline for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineOptions] - :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'source': {'key': 'properties.source', 'type': 'ImportPipelineSourceProperties'}, - 'trigger': {'key': 'properties.trigger', 'type': 'PipelineTriggerProperties'}, - 'options': {'key': 'properties.options', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipeline, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.identity = kwargs.get('identity', None) - self.source = kwargs.get('source', None) - self.trigger = kwargs.get('trigger', None) - self.options = kwargs.get('options', None) - self.provisioning_state = None - - -class ImportPipelineListResult(msrest.serialization.Model): - """The result of a request to list import pipelines for a container registry. - - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink - field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ImportPipeline]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ImportPipelineSourceProperties(msrest.serialization.Model): - """The properties of the import pipeline source. - - All required parameters must be populated in order to send to Azure. - - :param type: The type of source for the import pipeline. Possible values include: - "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. - When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS - token. - :type key_vault_uri: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportPipelineSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlobContainer") - self.uri = kwargs.get('uri', None) - self.key_vault_uri = kwargs['key_vault_uri'] - - -class ImportSource(msrest.serialization.Model): - """ImportSource. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str - """ - - _validation = { - 'source_image': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'registry_uri': {'key': 'registryUri', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, - 'source_image': {'key': 'sourceImage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSource, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.registry_uri = kwargs.get('registry_uri', None) - self.credentials = kwargs.get('credentials', None) - self.source_image = kwargs['source_image'] - - -class ImportSourceCredentials(msrest.serialization.Model): - """ImportSourceCredentials. - - All required parameters must be populated in order to send to Azure. - - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str - """ - - _validation = { - 'password': {'required': True}, - } - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImportSourceCredentials, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs['password'] - - -class InnerErrorDescription(msrest.serialization.Model): - """inner error. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InnerErrorDescription, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - - -class IPRule(msrest.serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 - address is allowed. - :type ip_address_or_range: str - """ - - _validation = { - 'ip_address_or_range': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'ip_address_or_range': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.ip_address_or_range = kwargs['ip_address_or_range'] - - -class KeyVaultProperties(msrest.serialization.Model): - """KeyVaultProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str - :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of - the key that is actually used for encryption. - :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str - :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. - :vartype key_rotation_enabled: bool - :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. - :vartype last_key_rotation_timestamp: ~datetime.datetime - """ - - _validation = { - 'versioned_key_identifier': {'readonly': True}, - 'key_rotation_enabled': {'readonly': True}, - 'last_key_rotation_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'versioned_key_identifier': {'key': 'versionedKeyIdentifier', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'str'}, - 'key_rotation_enabled': {'key': 'keyRotationEnabled', 'type': 'bool'}, - 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_identifier = kwargs.get('key_identifier', None) - self.versioned_key_identifier = None - self.identity = kwargs.get('identity', None) - self.key_rotation_enabled = None - self.last_key_rotation_timestamp = None - - -class LoggingProperties(msrest.serialization.Model): - """The logging properties of the connected registry. - - :param log_level: The verbosity of logs persisted on the connected registry. Possible values - include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". - :type log_level: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LogLevel - :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. - Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type audit_log_status: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.AuditLogStatus - """ - - _attribute_map = { - 'log_level': {'key': 'logLevel', 'type': 'str'}, - 'audit_log_status': {'key': 'auditLogStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoggingProperties, self).__init__(**kwargs) - self.log_level = kwargs.get('log_level', "Information") - self.audit_log_status = kwargs.get('audit_log_status', "Disabled") - - -class LoginServerProperties(msrest.serialization.Model): - """The login server properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar host: The host of the connected registry. Can be FQDN or IP. - :vartype host: str - :ivar tls: The TLS properties of the connected registry login server. - :vartype tls: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TlsProperties - """ - - _validation = { - 'host': {'readonly': True}, - 'tls': {'readonly': True}, - } - - _attribute_map = { - 'host': {'key': 'host', 'type': 'str'}, - 'tls': {'key': 'tls', 'type': 'TlsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(LoginServerProperties, self).__init__(**kwargs) - self.host = None - self.tls = None - - -class NetworkRuleSet(msrest.serialization.Model): - """The network rule set for a container registry. - - All required parameters must be populated in order to send to Azure. - - :param default_action: Required. The default action of allow or deny when no other rules match. - Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.IPRule] - """ - - _validation = { - 'default_action': {'required': True}, - } - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', "Allow") - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - self.ip_rules = kwargs.get('ip_rules', None) - - -class OperationDefinition(msrest.serialization.Model): - """The definition of a container registry operation. - - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationDisplayDefinition - :param is_data_action: This property indicates if the operation is an action or a data action - ref: - https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. - :type is_data_action: bool - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationServiceSpecificationDefinition - """ - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDefinition, self).__init__(**kwargs) - self.origin = kwargs.get('origin', None) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplayDefinition(msrest.serialization.Model): - """The display information for a container registry operation. - - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The result of a request to list container registry operations. - - :param value: The list of container registry operations. Since this list may be incomplete, the - nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry - operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationLogSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring log. - - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationLogSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class OperationMetricSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring metric. - - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class OperationServiceSpecificationDefinition(msrest.serialization.Model): - """The definition of Azure Monitoring list. - - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationLogSpecificationDefinition] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, - 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecificationDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - self.log_specifications = kwargs.get('log_specifications', None) - - -class ParentProperties(msrest.serialization.Model): - """The properties of the connected registry parent. - - All required parameters must be populated in order to send to Azure. - - :param id: The resource ID of the parent to which the connected registry will be associated. - :type id: str - :param sync_properties: Required. The sync properties of the connected registry with its - parent. - :type sync_properties: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SyncProperties - """ - - _validation = { - 'sync_properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'sync_properties': {'key': 'syncProperties', 'type': 'SyncProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ParentProperties, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.sync_properties = kwargs['sync_properties'] - - -class PipelineRun(ProxyResource): - """An object that represents a pipeline run for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of a pipeline run. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunRequest - :ivar response: The response of a pipeline run. - :vartype response: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline - run configuration has not changed. - :type force_update_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'request': {'key': 'properties.request', 'type': 'PipelineRunRequest'}, - 'response': {'key': 'properties.response', 'type': 'PipelineRunResponse'}, - 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRun, self).__init__(**kwargs) - self.provisioning_state = None - self.request = kwargs.get('request', None) - self.response = None - self.force_update_tag = kwargs.get('force_update_tag', None) - - -class PipelineRunListResult(msrest.serialization.Model): - """The result of a request to list pipeline runs for a container registry. - - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field - should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PipelineRun]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PipelineRunRequest(msrest.serialization.Model): - """The request properties provided for a pipeline run. - - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. - Specify an image by repository ('hello-world'). This will use the 'latest' tag. - Specify an image by tag ('hello-world:latest'). - Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - """ - - _attribute_map = { - 'pipeline_resource_id': {'key': 'pipelineResourceId', 'type': 'str'}, - 'artifacts': {'key': 'artifacts', 'type': '[str]'}, - 'source': {'key': 'source', 'type': 'PipelineRunSourceProperties'}, - 'target': {'key': 'target', 'type': 'PipelineRunTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunRequest, self).__init__(**kwargs) - self.pipeline_resource_id = kwargs.get('pipeline_resource_id', None) - self.artifacts = kwargs.get('artifacts', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - - -class PipelineRunResponse(msrest.serialization.Model): - """The response properties returned for a pipeline run. - - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case - of failure. - :type pipeline_run_error_message: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'imported_artifacts': {'key': 'importedArtifacts', 'type': '[str]'}, - 'progress': {'key': 'progress', 'type': 'ProgressProperties'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'source': {'key': 'source', 'type': 'ImportPipelineSourceProperties'}, - 'target': {'key': 'target', 'type': 'ExportPipelineTargetProperties'}, - 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, - 'trigger': {'key': 'trigger', 'type': 'PipelineTriggerDescriptor'}, - 'pipeline_run_error_message': {'key': 'pipelineRunErrorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunResponse, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.imported_artifacts = kwargs.get('imported_artifacts', None) - self.progress = kwargs.get('progress', None) - self.start_time = kwargs.get('start_time', None) - self.finish_time = kwargs.get('finish_time', None) - self.source = kwargs.get('source', None) - self.target = kwargs.get('target', None) - self.catalog_digest = kwargs.get('catalog_digest', None) - self.trigger = kwargs.get('trigger', None) - self.pipeline_run_error_message = kwargs.get('pipeline_run_error_message', None) - - -class PipelineRunSourceProperties(msrest.serialization.Model): - """PipelineRunSourceProperties. - - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunSourceProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineRunTargetProperties(msrest.serialization.Model): - """PipelineRunTargetProperties. - - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineRunTargetProperties, self).__init__(**kwargs) - self.type = kwargs.get('type', "AzureStorageBlob") - self.name = kwargs.get('name', None) - - -class PipelineSourceTriggerDescriptor(msrest.serialization.Model): - """PipelineSourceTriggerDescriptor. - - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime - """ - - _attribute_map = { - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) - self.timestamp = kwargs.get('timestamp', None) - - -class PipelineSourceTriggerProperties(msrest.serialization.Model): - """PipelineSourceTriggerProperties. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The current status of the source trigger. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TriggerStatus - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineSourceTriggerProperties, self).__init__(**kwargs) - self.status = kwargs.get('status', "Enabled") - - -class PipelineTriggerDescriptor(msrest.serialization.Model): - """PipelineTriggerDescriptor. - - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceTriggerDescriptor - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerDescriptor'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerDescriptor, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class PipelineTriggerProperties(msrest.serialization.Model): - """PipelineTriggerProperties. - - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceTriggerProperties - """ - - _attribute_map = { - 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PipelineTriggerProperties, self).__init__(**kwargs) - self.source_trigger = kwargs.get('source_trigger', None) - - -class Policies(msrest.serialization.Model): - """The policies for a container registry. - - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RetentionPolicy - :param export_policy: The export policy for a container registry. - :type export_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPolicy - """ - - _attribute_map = { - 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, - 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - 'export_policy': {'key': 'exportPolicy', 'type': 'ExportPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(Policies, self).__init__(**kwargs) - self.quarantine_policy = kwargs.get('quarantine_policy', None) - self.trust_policy = kwargs.get('trust_policy', None) - self.retention_policy = kwargs.get('retention_policy', None) - self.export_policy = kwargs.get('export_policy', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateEndpointConnection(ProxyResource): - """An object that represents a private endpoint connection for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of private endpoint connection resource. - Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """The result of a request to list private endpoint connections for a container registry. - - :param value: The list of private endpoint connections. Since this list may be incomplete, the - nextLink field should be used to request the next list of private endpoint connections. - :type value: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint - connections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(msrest.serialization.Model): - """A resource that supports private link capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The resource type is private link resource. - :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'type': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.type = None - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.group_id = kwargs.get('group_id', None) - self.required_members = kwargs.get('required_members', None) - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """The result of a request to list private link resources for a container registry. - - :param value: The list of private link resources. Since this list may be incomplete, the - nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The state of a private link service connection. - - :param status: The private link service connection status. Possible values include: "Approved", - "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ProgressProperties(msrest.serialization.Model): - """ProgressProperties. - - :param percentage: The percentage complete of the copy operation. - :type percentage: str - """ - - _attribute_map = { - 'percentage': {'key': 'percentage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProgressProperties, self).__init__(**kwargs) - self.percentage = kwargs.get('percentage', None) - - -class QuarantinePolicy(msrest.serialization.Model): - """The quarantine policy for a container registry. - - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuarantinePolicy, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - - -class RegenerateCredentialParameters(msrest.serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateCredentialParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.system_data = None - - -class Registry(Resource): - """An object that represents a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties - :ivar login_server: The URL that can be used to log into the container registry. - :vartype login_server: str - :ivar creation_date: The creation date of the container registry in ISO8601 format. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the container registry at the time the - operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", - "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :ivar status: The status of the container registry at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :ivar data_endpoint_host_names: List of host names that will serve data when - dataEndpointEnabled is true. - :vartype data_endpoint_host_names: list[str] - :ivar private_endpoint_connections: List of private endpoint connections for a container - registry. - :vartype private_endpoint_connections: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleBypassOptions - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. - Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ZoneRedundancy - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'sku': {'required': True}, - 'login_server': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'data_endpoint_host_names': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'data_endpoint_host_names': {'key': 'properties.dataEndpointHostNames', 'type': '[str]'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, - 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Registry, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.identity = kwargs.get('identity', None) - self.login_server = None - self.creation_date = None - self.provisioning_state = None - self.status = None - self.admin_user_enabled = kwargs.get('admin_user_enabled', False) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.data_endpoint_host_names = None - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - self.zone_redundancy = kwargs.get('zone_redundancy', None) - self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', False) - - -class RegistryListCredentialsResult(msrest.serialization.Model): - """The response from the ListCredentials operation. - - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryPassword] - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListCredentialsResult, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.passwords = kwargs.get('passwords', None) - - -class RegistryListResult(msrest.serialization.Model): - """The result of a request to list container registries. - - :param value: The list of container registries. Since this list may be incomplete, the nextLink - field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Registry]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RegistryNameCheckRequest(msrest.serialization.Model): - """A request to check whether a container registry name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the container registry. - :type name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Has constant value: - "Microsoft.ContainerRegistry/registries". - :vartype type: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - **kwargs - ): - super(RegistryNameCheckRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class RegistryNameStatus(msrest.serialization.Model): - """The result of a request to check the availability of a container registry name. - - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryNameStatus, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class RegistryPassword(msrest.serialization.Model): - """The login password for the container registry. - - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName - :param value: The password value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryPassword, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class RegistryUpdateParameters(msrest.serialization.Model): - """The parameters for updating a container registry. - - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container - registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleBypassOptions - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, - 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, - 'policies': {'key': 'properties.policies', 'type': 'Policies'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, - 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, - 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUpdateParameters, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.admin_user_enabled = kwargs.get('admin_user_enabled', None) - self.network_rule_set = kwargs.get('network_rule_set', None) - self.policies = kwargs.get('policies', None) - self.encryption = kwargs.get('encryption', None) - self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) - self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', None) - - -class RegistryUsage(msrest.serialization.Model): - """The quota usage for a container registry. - - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsageUnit - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsage, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.limit = kwargs.get('limit', None) - self.current_value = kwargs.get('current_value', None) - self.unit = kwargs.get('unit', None) - - -class RegistryUsageListResult(msrest.serialization.Model): - """The result of a request to get container registry quota usages. - - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RegistryUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistryUsageListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Replication(Resource): - """An object that represents a replication for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :ivar provisioning_state: The provisioning state of the replication at the time the operation - was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :ivar status: The status of the replication at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry - replication. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ZoneRedundancy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'Status'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Replication, self).__init__(**kwargs) - self.provisioning_state = None - self.status = None - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', True) - self.zone_redundancy = kwargs.get('zone_redundancy', None) - - -class ReplicationListResult(msrest.serialization.Model): - """The result of a request to list replications for a container registry. - - :param value: The list of replications. Since this list may be incomplete, the nextLink field - should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Replication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ReplicationUpdateParameters(msrest.serialization.Model): - """The parameters for updating a replication. - - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is - enabled. Requests will not be routed to a replication whose regional endpoint is disabled, - however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', None) - - -class Request(msrest.serialization.Model): - """The request that generated the event. - - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the - event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the - http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'addr': {'key': 'addr', 'type': 'str'}, - 'host': {'key': 'host', 'type': 'str'}, - 'method': {'key': 'method', 'type': 'str'}, - 'useragent': {'key': 'useragent', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.addr = kwargs.get('addr', None) - self.host = kwargs.get('host', None) - self.method = kwargs.get('method', None) - self.useragent = kwargs.get('useragent', None) - - -class RetentionPolicy(msrest.serialization.Model): - """The retention policy for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int - :ivar last_updated_time: The timestamp when the policy was last updated. - :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus - """ - - _validation = { - 'last_updated_time': {'readonly': True}, - } - - _attribute_map = { - 'days': {'key': 'days', 'type': 'int'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RetentionPolicy, self).__init__(**kwargs) - self.days = kwargs.get('days', 7) - self.last_updated_time = None - self.status = kwargs.get('status', None) - - -class ScopeMap(ProxyResource): - """An object that represents a scope map for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str - :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. - :vartype type_properties_type: str - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. - E.g. repositories/repository-name/content/read, - repositories/repository-name/metadata/write. - :type actions: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'type_properties_type': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMap, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.type_properties_type = None - self.creation_date = None - self.provisioning_state = None - self.actions = kwargs.get('actions', None) - - -class ScopeMapListResult(msrest.serialization.Model): - """The result of a request to list scope maps for a container registry. - - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field - should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScopeMap]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ScopeMapUpdateParameters(msrest.serialization.Model): - """The properties for updating the scope map. - - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. - E.g. repositories/repository-name/pull, - repositories/repository-name/delete. - :type actions: list[str] - """ - - _attribute_map = { - 'description': {'key': 'properties.description', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeMapUpdateParameters, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.actions = kwargs.get('actions', None) - - -class Sku(msrest.serialization.Model): - """The SKU of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name of the container registry. Required for registry creation. - Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SkuName - :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class Source(msrest.serialization.Model): - """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - - :param addr: The IP or hostname and the port of the registry node that generated the event. - Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str - """ - - _attribute_map = { - 'addr': {'key': 'addr', 'type': 'str'}, - 'instance_id': {'key': 'instanceID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Source, self).__init__(**kwargs) - self.addr = kwargs.get('addr', None) - self.instance_id = kwargs.get('instance_id', None) - - -class Status(msrest.serialization.Model): - """The status of an Azure resource at the time the operation was called. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_status: The short label for the status. - :vartype display_status: str - :ivar message: The detailed message for the status, including alerts and error messages. - :vartype message: str - :ivar timestamp: The timestamp when the status was changed to the current value. - :vartype timestamp: ~datetime.datetime - """ - - _validation = { - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'timestamp': {'readonly': True}, - } - - _attribute_map = { - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Status, self).__init__(**kwargs) - self.display_status = None - self.message = None - self.timestamp = None - - -class StatusDetailProperties(msrest.serialization.Model): - """The status detail properties of the connected registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The component of the connected registry corresponding to the status. - :vartype type: str - :ivar code: The code of the status. - :vartype code: str - :ivar description: The description of the status. - :vartype description: str - :ivar timestamp: The timestamp of the status. - :vartype timestamp: ~datetime.datetime - :ivar correlation_id: The correlation ID of the status. - :vartype correlation_id: str - """ - - _validation = { - 'type': {'readonly': True}, - 'code': {'readonly': True}, - 'description': {'readonly': True}, - 'timestamp': {'readonly': True}, - 'correlation_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StatusDetailProperties, self).__init__(**kwargs) - self.type = None - self.code = None - self.description = None - self.timestamp = None - self.correlation_id = None - - -class SyncProperties(msrest.serialization.Model): - """The sync properties of the connected registry with its parent. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param token_id: Required. The resource ID of the ACR token used to authenticate the connected - registry to its parent during sync. - :type token_id: str - :param schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. - Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: Required. The period of time for which a message is available to sync - before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per - ISO8601. - :type message_ttl: ~datetime.timedelta - :ivar last_sync_time: The last time a sync occurred between the connected registry and its - parent. - :vartype last_sync_time: ~datetime.datetime - :ivar gateway_endpoint: The gateway endpoint used by the connected registry to communicate with - its parent. - :vartype gateway_endpoint: str - """ - - _validation = { - 'token_id': {'required': True}, - 'message_ttl': {'required': True}, - 'last_sync_time': {'readonly': True}, - 'gateway_endpoint': {'readonly': True}, - } - - _attribute_map = { - 'token_id': {'key': 'tokenId', 'type': 'str'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, - 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, - 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, - 'gateway_endpoint': {'key': 'gatewayEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncProperties, self).__init__(**kwargs) - self.token_id = kwargs['token_id'] - self.schedule = kwargs.get('schedule', None) - self.sync_window = kwargs.get('sync_window', None) - self.message_ttl = kwargs['message_ttl'] - self.last_sync_time = None - self.gateway_endpoint = None - - -class SyncUpdateProperties(msrest.serialization.Model): - """The parameters for updating the sync properties of the connected registry with its parent. - - :param schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. - Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: The period of time for which a message is available to sync before it is - expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type message_ttl: ~datetime.timedelta - """ - - _attribute_map = { - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, - 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncUpdateProperties, self).__init__(**kwargs) - self.schedule = kwargs.get('schedule', None) - self.sync_window = kwargs.get('sync_window', None) - self.message_ttl = kwargs.get('message_ttl', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Target(msrest.serialization.Model): - """The target of the event. - - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str - """ - - _attribute_map = { - 'media_type': {'key': 'mediaType', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'long'}, - 'digest': {'key': 'digest', 'type': 'str'}, - 'length': {'key': 'length', 'type': 'long'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Target, self).__init__(**kwargs) - self.media_type = kwargs.get('media_type', None) - self.size = kwargs.get('size', None) - self.digest = kwargs.get('digest', None) - self.length = kwargs.get('length', None) - self.repository = kwargs.get('repository', None) - self.url = kwargs.get('url', None) - self.tag = kwargs.get('tag', None) - self.name = kwargs.get('name', None) - self.version = kwargs.get('version', None) - - -class TlsCertificateProperties(msrest.serialization.Model): - """The TLS certificate properties of the connected registry login server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of certificate location. Possible values include: "LocalDirectory". - :vartype type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.CertificateType - :ivar location: Indicates the location of the certificates. - :vartype location: str - """ - - _validation = { - 'type': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TlsCertificateProperties, self).__init__(**kwargs) - self.type = None - self.location = None - - -class TlsProperties(msrest.serialization.Model): - """The TLS properties of the connected registry login server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: Indicates whether HTTPS is enabled for the login server. Possible values include: - "Enabled", "Disabled". - :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TlsStatus - :ivar certificate: The certificate used to configure HTTPS for the login server. - :vartype certificate: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TlsCertificateProperties - """ - - _validation = { - 'status': {'readonly': True}, - 'certificate': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'TlsCertificateProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TlsProperties, self).__init__(**kwargs) - self.status = None - self.certificate = None - - -class Token(ProxyResource): - """An object that represents a token for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Token, self).__init__(**kwargs) - self.creation_date = None - self.provisioning_state = None - self.scope_map_id = kwargs.get('scope_map_id', None) - self.credentials = kwargs.get('credentials', None) - self.status = kwargs.get('status', None) - - -class TokenCertificate(msrest.serialization.Model): - """The properties of a certificate used for authenticating a token. - - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format - that will be used for authenticating the token. - :type encoded_pem_certificate: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'encoded_pem_certificate': {'key': 'encodedPemCertificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCertificate, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.expiry = kwargs.get('expiry', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.encoded_pem_certificate = kwargs.get('encoded_pem_certificate', None) - - -class TokenCredentialsProperties(msrest.serialization.Model): - """The properties of the credentials that can be used for authenticating the token. - - :param certificates: - :type certificates: - list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] - """ - - _attribute_map = { - 'certificates': {'key': 'certificates', 'type': '[TokenCertificate]'}, - 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenCredentialsProperties, self).__init__(**kwargs) - self.certificates = kwargs.get('certificates', None) - self.passwords = kwargs.get('passwords', None) - - -class TokenListResult(msrest.serialization.Model): - """The result of a request to list tokens for a container registry. - - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should - be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Token]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class TokenPassword(msrest.serialization.Model): - """The password that will be used for authenticating the token of a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName - :ivar value: The password value. - :vartype value: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, - 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenPassword, self).__init__(**kwargs) - self.creation_time = kwargs.get('creation_time', None) - self.expiry = kwargs.get('expiry', None) - self.name = kwargs.get('name', None) - self.value = None - - -class TokenUpdateParameters(msrest.serialization.Model): - """The parameters for updating a token. - - :param scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: - "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCredentialsProperties - """ - - _attribute_map = { - 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenUpdateParameters, self).__init__(**kwargs) - self.scope_map_id = kwargs.get('scope_map_id', None) - self.status = kwargs.get('status', None) - self.credentials = kwargs.get('credentials', None) - - -class TrustPolicy(msrest.serialization.Model): - """The content trust policy for a container registry. - - :param type: The type of trust policy. Possible values include: "Notary". Default value: - "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustPolicy, self).__init__(**kwargs) - self.type = kwargs.get('type', "Notary") - self.status = kwargs.get('status', None) - - -class UserIdentityProperties(msrest.serialization.Model): - """UserIdentityProperties. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) - - -class VirtualNetworkRule(msrest.serialization.Model): - """Virtual network rule. - - All required parameters must be populated in order to send to Azure. - - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str - """ - - _validation = { - 'virtual_network_resource_id': {'required': True}, - } - - _attribute_map = { - 'action': {'key': 'action', 'type': 'str'}, - 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.action = kwargs.get('action', None) - self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] - - -class Webhook(Resource): - """An object that represents a webhook for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the - resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] - :ivar provisioning_state: The provisioning state of the webhook at the time the operation was - called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", - "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Webhook, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - self.provisioning_state = None - - -class WebhookCreateParameters(msrest.serialization.Model): - """The parameters for creating a webhook. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the - resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) - - -class WebhookListResult(msrest.serialization.Model): - """The result of a request to list webhooks for a container registry. - - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Webhook]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WebhookUpdateParameters(msrest.serialization.Model): - """The parameters for updating a webhook. - - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values - include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' - means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. - 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or - ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'actions': {'key': 'properties.actions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebhookUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.service_uri = kwargs.get('service_uri', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.status = kwargs.get('status', None) - self.scope = kwargs.get('scope', None) - self.actions = kwargs.get('actions', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models_py3.py index aaf5403b0e41..5e107e6cec76 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/models/_models_py3.py @@ -38,6 +38,8 @@ def __init__( self, **kwargs ): + """ + """ super(ActivationProperties, self).__init__(**kwargs) self.status = None @@ -45,12 +47,12 @@ def __init__( class ActiveDirectoryObject(msrest.serialization.Model): """The Active Directory Object that will be used for authenticating the token of a container registry. - :param object_id: The user/group/application object ID for Active Directory Object that will be + :ivar object_id: The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. - :type object_id: str - :param tenant_id: The tenant ID of user/group/application object Active Directory Object that + :vartype object_id: str + :ivar tenant_id: The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. - :type tenant_id: str + :vartype tenant_id: str """ _attribute_map = { @@ -65,6 +67,14 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword object_id: The user/group/application object ID for Active Directory Object that will + be used for authenticating the token of a container registry. + :paramtype object_id: str + :keyword tenant_id: The tenant ID of user/group/application object Active Directory Object that + will be used for authenticating the token of a container registry. + :paramtype tenant_id: str + """ super(ActiveDirectoryObject, self).__init__(**kwargs) self.object_id = object_id self.tenant_id = tenant_id @@ -73,9 +83,9 @@ def __init__( class Actor(msrest.serialization.Model): """The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :param name: The subject or username associated with the request context that generated the + :ivar name: The subject or username associated with the request context that generated the event. - :type name: str + :vartype name: str """ _attribute_map = { @@ -88,6 +98,11 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The subject or username associated with the request context that generated the + event. + :paramtype name: str + """ super(Actor, self).__init__(**kwargs) self.name = name @@ -97,10 +112,10 @@ class CallbackConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_uri: Required. The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] + :ivar service_uri: Required. The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] """ _validation = { @@ -119,6 +134,12 @@ def __init__( custom_headers: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword service_uri: Required. The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + """ super(CallbackConfig, self).__init__(**kwargs) self.service_uri = service_uri self.custom_headers = custom_headers @@ -157,6 +178,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -181,9 +204,9 @@ class ConnectedRegistry(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param mode: The mode of the connected registry resource that indicates the permissions of the + :ivar mode: The mode of the connected registry resource that indicates the permissions of the registry. Possible values include: "ReadWrite", "ReadOnly", "Registry", "Mirror". - :type mode: str or + :vartype mode: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryMode :ivar version: The current version of ACR runtime on the connected registry. :vartype version: str @@ -196,22 +219,22 @@ class ConnectedRegistry(ProxyResource): :ivar activation: The activation properties of the connected registry. :vartype activation: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ActivationProperties - :param parent: The parent of the connected registry. - :type parent: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ParentProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + :ivar parent: The parent of the connected registry. + :vartype parent: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ParentProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to the connected registry. - :type client_token_ids: list[str] - :param login_server: The login server properties of the connected registry. - :type login_server: + :vartype client_token_ids: list[str] + :ivar login_server: The login server properties of the connected registry. + :vartype login_server: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoginServerProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties :ivar status_details: The list of current statuses of the connected registry. :vartype status_details: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.StatusDetailProperties] - :param notifications_list: The list of notifications subscription information for the connected + :ivar notifications_list: The list of notifications subscription information for the connected registry. - :type notifications_list: list[str] + :vartype notifications_list: list[str] """ _validation = { @@ -257,6 +280,25 @@ def __init__( notifications_list: Optional[List[str]] = None, **kwargs ): + """ + :keyword mode: The mode of the connected registry resource that indicates the permissions of + the registry. Possible values include: "ReadWrite", "ReadOnly", "Registry", "Mirror". + :paramtype mode: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryMode + :keyword parent: The parent of the connected registry. + :paramtype parent: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ParentProperties + :keyword client_token_ids: The list of the ACR token resource IDs used to authenticate clients + to the connected registry. + :paramtype client_token_ids: list[str] + :keyword login_server: The login server properties of the connected registry. + :paramtype login_server: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoginServerProperties + :keyword logging: The logging properties of the connected registry. + :paramtype logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties + :keyword notifications_list: The list of notifications subscription information for the + connected registry. + :paramtype notifications_list: list[str] + """ super(ConnectedRegistry, self).__init__(**kwargs) self.provisioning_state = None self.mode = mode @@ -275,11 +317,12 @@ def __init__( class ConnectedRegistryListResult(msrest.serialization.Model): """The result of a request to list connected registries for a container registry. - :param value: The list of connected registries. Since this list may be incomplete, the nextLink + :ivar value: The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next list of connected registries. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] - :param next_link: The URI that can be used to request the next list of connected registries. - :type next_link: str + :vartype value: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] + :ivar next_link: The URI that can be used to request the next list of connected registries. + :vartype next_link: str """ _attribute_map = { @@ -294,6 +337,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of connected registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of connected registries. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] + :keyword next_link: The URI that can be used to request the next list of connected registries. + :paramtype next_link: str + """ super(ConnectedRegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -302,17 +353,17 @@ def __init__( class ConnectedRegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a connected registry. - :param sync_properties: The sync properties of the connected registry with its parent. - :type sync_properties: + :ivar sync_properties: The sync properties of the connected registry with its parent. + :vartype sync_properties: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SyncUpdateProperties - :param logging: The logging properties of the connected registry. - :type logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties - :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to the connected registry. - :type client_token_ids: list[str] - :param notifications_list: The list of notifications subscription information for the connected + :vartype client_token_ids: list[str] + :ivar notifications_list: The list of notifications subscription information for the connected registry. - :type notifications_list: list[str] + :vartype notifications_list: list[str] """ _attribute_map = { @@ -331,6 +382,19 @@ def __init__( notifications_list: Optional[List[str]] = None, **kwargs ): + """ + :keyword sync_properties: The sync properties of the connected registry with its parent. + :paramtype sync_properties: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SyncUpdateProperties + :keyword logging: The logging properties of the connected registry. + :paramtype logging: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LoggingProperties + :keyword client_token_ids: The list of the ACR token resource IDs used to authenticate clients + to the connected registry. + :paramtype client_token_ids: list[str] + :keyword notifications_list: The list of notifications subscription information for the + connected registry. + :paramtype notifications_list: list[str] + """ super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) self.sync_properties = sync_properties self.logging = logging @@ -341,11 +405,12 @@ def __init__( class EncryptionProperty(msrest.serialization.Model): """EncryptionProperty. - :param status: Indicates whether or not the encryption is enabled for container registry. + :ivar status: Indicates whether or not the encryption is enabled for container registry. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionStatus - :param key_vault_properties: Key vault properties. - :type key_vault_properties: + :vartype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionStatus + :ivar key_vault_properties: Key vault properties. + :vartype key_vault_properties: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.KeyVaultProperties """ @@ -361,6 +426,15 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionStatus + :keyword key_vault_properties: Key vault properties. + :paramtype key_vault_properties: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.KeyVaultProperties + """ super(EncryptionProperty, self).__init__(**kwargs) self.status = status self.key_vault_properties = key_vault_properties @@ -369,8 +443,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the Azure Container Registry service. - :param error: Azure container registry build API error body. - :type error: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ErrorResponseBody + :ivar error: Azure container registry build API error body. + :vartype error: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ErrorResponseBody """ _attribute_map = { @@ -383,6 +457,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: Azure container registry build API error body. + :paramtype error: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -392,15 +470,16 @@ class ErrorResponseBody(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str - :param details: an array of additional nested error response info objects, as described by this + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str + :ivar details: an array of additional nested error response info objects, as described by this contract. - :type details: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.InnerErrorDescription + :vartype details: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.InnerErrorDescription] """ _validation = { @@ -412,7 +491,7 @@ class ErrorResponseBody(msrest.serialization.Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, + 'details': {'key': 'details', 'type': '[InnerErrorDescription]'}, } def __init__( @@ -421,9 +500,21 @@ def __init__( code: str, message: str, target: Optional[str] = None, - details: Optional["InnerErrorDescription"] = None, + details: Optional[List["InnerErrorDescription"]] = None, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + :keyword details: an array of additional nested error response info objects, as described by + this contract. + :paramtype details: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.InnerErrorDescription] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -434,8 +525,8 @@ def __init__( class EventInfo(msrest.serialization.Model): """The basic information of an event. - :param id: The event ID. - :type id: str + :ivar id: The event ID. + :vartype id: str """ _attribute_map = { @@ -448,6 +539,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + """ super(EventInfo, self).__init__(**kwargs) self.id = id @@ -455,13 +550,13 @@ def __init__( class Event(EventInfo): """The event for a webhook. - :param id: The event ID. - :type id: str - :param event_request_message: The event request message sent to the service URI. - :type event_request_message: + :ivar id: The event ID. + :vartype id: str + :ivar event_request_message: The event request message sent to the service URI. + :vartype event_request_message: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventRequestMessage - :param event_response_message: The event response message received from the service URI. - :type event_response_message: + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventResponseMessage """ @@ -479,6 +574,16 @@ def __init__( event_response_message: Optional["EventResponseMessage"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword event_request_message: The event request message sent to the service URI. + :paramtype event_request_message: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventRequestMessage + :keyword event_response_message: The event response message received from the service URI. + :paramtype event_response_message: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventResponseMessage + """ super(Event, self).__init__(id=id, **kwargs) self.event_request_message = event_request_message self.event_response_message = event_response_message @@ -487,22 +592,22 @@ def __init__( class EventContent(msrest.serialization.Model): """The content of the event request message. - :param id: The event ID. - :type id: str - :param timestamp: The time at which the event occurred. - :type timestamp: ~datetime.datetime - :param action: The action that encompasses the provided event. - :type action: str - :param target: The target of the event. - :type target: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Target - :param request: The request that generated the event. - :type request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Request - :param actor: The agent that initiated the event. For most situations, this could be from the + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar target: The target of the event. + :vartype target: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Request + :ivar actor: The agent that initiated the event. For most situations, this could be from the authorization context of the request. - :type actor: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Actor - :param source: The registry node that generated the event. Put differently, while the actor + :vartype actor: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Actor + :ivar source: The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :type source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Source + :vartype source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Source """ _attribute_map = { @@ -527,6 +632,24 @@ def __init__( source: Optional["Source"] = None, **kwargs ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword timestamp: The time at which the event occurred. + :paramtype timestamp: ~datetime.datetime + :keyword action: The action that encompasses the provided event. + :paramtype action: str + :keyword target: The target of the event. + :paramtype target: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Target + :keyword request: The request that generated the event. + :paramtype request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Request + :keyword actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :paramtype actor: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Actor + :keyword source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :paramtype source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Source + """ super(EventContent, self).__init__(**kwargs) self.id = id self.timestamp = timestamp @@ -540,11 +663,11 @@ def __init__( class EventListResult(msrest.serialization.Model): """The result of a request to list events for a webhook. - :param value: The list of events. Since this list may be incomplete, the nextLink field should + :ivar value: The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Event] - :param next_link: The URI that can be used to request the next list of events. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Event] + :ivar next_link: The URI that can be used to request the next list of events. + :vartype next_link: str """ _attribute_map = { @@ -559,6 +682,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of events. Since this list may be incomplete, the nextLink field + should be used to request the next list of events. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Event] + :keyword next_link: The URI that can be used to request the next list of events. + :paramtype next_link: str + """ super(EventListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -567,16 +697,16 @@ def __init__( class EventRequestMessage(msrest.serialization.Model): """The event request message sent to the service URI. - :param content: The content of the event request message. - :type content: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventContent - :param headers: The headers of the event request message. - :type headers: dict[str, str] - :param method: The HTTP method used to send the event request message. - :type method: str - :param request_uri: The URI used to send the event request message. - :type request_uri: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventContent + :ivar headers: The headers of the event request message. + :vartype headers: dict[str, str] + :ivar method: The HTTP method used to send the event request message. + :vartype method: str + :ivar request_uri: The URI used to send the event request message. + :vartype request_uri: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -597,6 +727,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event request message. + :paramtype content: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventContent + :keyword headers: The headers of the event request message. + :paramtype headers: dict[str, str] + :keyword method: The HTTP method used to send the event request message. + :paramtype method: str + :keyword request_uri: The URI used to send the event request message. + :paramtype request_uri: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventRequestMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -608,16 +750,16 @@ def __init__( class EventResponseMessage(msrest.serialization.Model): """The event response message received from the service URI. - :param content: The content of the event response message. - :type content: str - :param headers: The headers of the event response message. - :type headers: dict[str, str] - :param reason_phrase: The reason phrase of the event response message. - :type reason_phrase: str - :param status_code: The status code of the event response message. - :type status_code: str - :param version: The HTTP message version. - :type version: str + :ivar content: The content of the event response message. + :vartype content: str + :ivar headers: The headers of the event response message. + :vartype headers: dict[str, str] + :ivar reason_phrase: The reason phrase of the event response message. + :vartype reason_phrase: str + :ivar status_code: The status code of the event response message. + :vartype status_code: str + :ivar version: The HTTP message version. + :vartype version: str """ _attribute_map = { @@ -638,6 +780,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the event response message. + :paramtype content: str + :keyword headers: The headers of the event response message. + :paramtype headers: dict[str, str] + :keyword reason_phrase: The reason phrase of the event response message. + :paramtype reason_phrase: str + :keyword status_code: The status code of the event response message. + :paramtype status_code: str + :keyword version: The HTTP message version. + :paramtype version: str + """ super(EventResponseMessage, self).__init__(**kwargs) self.content = content self.headers = headers @@ -659,15 +813,15 @@ class ExportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param location: The location of the export pipeline. - :type location: str - :param identity: The identity of the export pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties - :param target: The target properties of the export pipeline. - :type target: + :ivar location: The location of the export pipeline. + :vartype location: str + :ivar identity: The identity of the export pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :ivar target: The target properties of the export pipeline. + :vartype target: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineTargetProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -705,6 +859,19 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the export pipeline. + :paramtype location: str + :keyword identity: The identity of the export pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :keyword target: The target properties of the export pipeline. + :paramtype target: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineTargetProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineOptions] + """ super(ExportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -716,11 +883,11 @@ def __init__( class ExportPipelineListResult(msrest.serialization.Model): """The result of a request to list export pipelines for a container registry. - :param value: The list of export pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -735,6 +902,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of export pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of export pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ExportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -745,15 +919,15 @@ class ExportPipelineTargetProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of target for the export pipeline. - :type type: str - :param uri: The target uri of the export pipeline. + :ivar type: The type of target for the export pipeline. + :vartype type: str + :ivar uri: The target uri of the export pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -774,6 +948,17 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of target for the export pipeline. + :paramtype type: str + :keyword uri: The target uri of the export pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + token. + :paramtype key_vault_uri: str + """ super(ExportPipelineTargetProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -783,9 +968,9 @@ def __init__( class ExportPolicy(msrest.serialization.Model): """The export policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". Default value: "enabled". - :type status: str or + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPolicyStatus """ @@ -799,6 +984,12 @@ def __init__( status: Optional[Union[str, "ExportPolicyStatus"]] = "enabled", **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". Default value: "enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPolicyStatus + """ super(ExportPolicy, self).__init__(**kwargs) self.status = status @@ -806,14 +997,15 @@ def __init__( class GenerateCredentialsParameters(msrest.serialization.Model): """The parameters used to generate credentials for a specified token or user of a container registry. - :param token_id: The resource ID of the token for which credentials have to be generated. - :type token_id: str - :param expiry: The expiry date of the generated credentials after which the credentials become + :ivar token_id: The resource ID of the token for which credentials have to be generated. + :vartype token_id: str + :ivar expiry: The expiry date of the generated credentials after which the credentials become invalid. - :type expiry: ~datetime.datetime - :param name: Specifies name of the password which should be regenerated if any -- password1 or + :vartype expiry: ~datetime.datetime + :ivar name: Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName + :vartype name: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName """ _attribute_map = { @@ -830,6 +1022,17 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword token_id: The resource ID of the token for which credentials have to be generated. + :paramtype token_id: str + :keyword expiry: The expiry date of the generated credentials after which the credentials + become invalid. + :paramtype expiry: ~datetime.datetime + :keyword name: Specifies name of the password which should be regenerated if any -- password1 + or password2. Possible values include: "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName + """ super(GenerateCredentialsParameters, self).__init__(**kwargs) self.token_id = token_id self.expiry = expiry @@ -839,10 +1042,11 @@ def __init__( class GenerateCredentialsResult(msrest.serialization.Model): """The response from the GenerateCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] """ _attribute_map = { @@ -857,6 +1061,13 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] + """ super(GenerateCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -865,20 +1076,20 @@ def __init__( class IdentityProperties(msrest.serialization.Model): """Managed identity for the resource. - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or + :vartype type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.containerregistry.v2021_08_01_preview.models.UserIdentityProperties] """ @@ -898,6 +1109,23 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.UserIdentityProperties] + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id @@ -910,18 +1138,18 @@ class ImportImageParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source: Required. The source of the image. - :type source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportSource - :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + :ivar source: Required. The source of the image. + :vartype source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportSource + :ivar target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - :type target_tags: list[str] - :param untagged_target_repositories: List of strings of repository names to do a manifest only + :vartype target_tags: list[str] + :ivar untagged_target_repositories: List of strings of repository names to do a manifest only copy. No tag will be created. - :type untagged_target_repositories: list[str] - :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + :vartype untagged_target_repositories: list[str] + :ivar mode: When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: "NoForce", "Force". Default value: "NoForce". - :type mode: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportMode + :vartype mode: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportMode """ _validation = { @@ -944,6 +1172,20 @@ def __init__( mode: Optional[Union[str, "ImportMode"]] = "NoForce", **kwargs ): + """ + :keyword source: Required. The source of the image. + :paramtype source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportSource + :keyword target_tags: List of strings of the form repo[:tag]. When tag is omitted the source + will be used (or 'latest' if source tag is also omitted). + :paramtype target_tags: list[str] + :keyword untagged_target_repositories: List of strings of repository names to do a manifest + only copy. No tag will be created. + :paramtype untagged_target_repositories: list[str] + :keyword mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :paramtype mode: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportMode + """ super(ImportImageParameters, self).__init__(**kwargs) self.source = source self.target_tags = target_tags @@ -964,18 +1206,18 @@ class ImportPipeline(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param location: The location of the import pipeline. - :type location: str - :param identity: The identity of the import pipeline. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties - :param source: The source properties of the import pipeline. - :type source: + :ivar location: The location of the import pipeline. + :vartype location: str + :ivar identity: The identity of the import pipeline. + :vartype identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :ivar source: The source properties of the import pipeline. + :vartype source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineSourceProperties - :param trigger: The properties that describe the trigger of the import pipeline. - :type trigger: + :ivar trigger: The properties that describe the trigger of the import pipeline. + :vartype trigger: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineTriggerProperties - :param options: The list of all options configured for the pipeline. - :type options: list[str or + :ivar options: The list of all options configured for the pipeline. + :vartype options: list[str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineOptions] :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -1015,6 +1257,22 @@ def __init__( options: Optional[List[Union[str, "PipelineOptions"]]] = None, **kwargs ): + """ + :keyword location: The location of the import pipeline. + :paramtype location: str + :keyword identity: The identity of the import pipeline. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :keyword source: The source properties of the import pipeline. + :paramtype source: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineSourceProperties + :keyword trigger: The properties that describe the trigger of the import pipeline. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineTriggerProperties + :keyword options: The list of all options configured for the pipeline. + :paramtype options: list[str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineOptions] + """ super(ImportPipeline, self).__init__(**kwargs) self.location = location self.identity = identity @@ -1027,11 +1285,11 @@ def __init__( class ImportPipelineListResult(msrest.serialization.Model): """The result of a request to list import pipelines for a container registry. - :param value: The list of import pipelines. Since this list may be incomplete, the nextLink + :ivar value: The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -1046,6 +1304,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of import pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of import pipelines. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(ImportPipelineListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1056,16 +1321,17 @@ class ImportPipelineSourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: The type of source for the import pipeline. Possible values include: + :ivar type: The type of source for the import pipeline. Possible values include: "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". - :type type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceType - :param uri: The source uri of the import pipeline. + :vartype type: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceType + :ivar uri: The source uri of the import pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". - :type uri: str - :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + :vartype uri: str + :ivar key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS token. - :type key_vault_uri: str + :vartype key_vault_uri: str """ _validation = { @@ -1086,6 +1352,19 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of source for the import pipeline. Possible values include: + "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceType + :keyword uri: The source uri of the import pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :paramtype uri: str + :keyword key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + token. + :paramtype key_vault_uri: str + """ super(ImportPipelineSourceProperties, self).__init__(**kwargs) self.type = type self.uri = uri @@ -1097,18 +1376,18 @@ class ImportSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: The resource identifier of the source Azure Container Registry. - :type resource_id: str - :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). - :type registry_uri: str - :param credentials: Credentials used when importing from a registry uri. - :type credentials: + :ivar resource_id: The resource identifier of the source Azure Container Registry. + :vartype resource_id: str + :ivar registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :vartype registry_uri: str + :ivar credentials: Credentials used when importing from a registry uri. + :vartype credentials: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportSourceCredentials - :param source_image: Required. Repository name of the source image. + :ivar source_image: Required. Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type source_image: str + :vartype source_image: str """ _validation = { @@ -1131,6 +1410,20 @@ def __init__( credentials: Optional["ImportSourceCredentials"] = None, **kwargs ): + """ + :keyword resource_id: The resource identifier of the source Azure Container Registry. + :paramtype resource_id: str + :keyword registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :paramtype registry_uri: str + :keyword credentials: Credentials used when importing from a registry uri. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportSourceCredentials + :keyword source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype source_image: str + """ super(ImportSource, self).__init__(**kwargs) self.resource_id = resource_id self.registry_uri = registry_uri @@ -1143,10 +1436,10 @@ class ImportSourceCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: The username to authenticate with the source registry. - :type username: str - :param password: Required. The password used to authenticate with the source registry. - :type password: str + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: Required. The password used to authenticate with the source registry. + :vartype password: str """ _validation = { @@ -1165,6 +1458,12 @@ def __init__( username: Optional[str] = None, **kwargs ): + """ + :keyword username: The username to authenticate with the source registry. + :paramtype username: str + :keyword password: Required. The password used to authenticate with the source registry. + :paramtype password: str + """ super(ImportSourceCredentials, self).__init__(**kwargs) self.username = username self.password = password @@ -1175,12 +1474,12 @@ class InnerErrorDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - :param target: target of the particular error. - :type target: str + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str """ _validation = { @@ -1202,6 +1501,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + """ super(InnerErrorDescription, self).__init__(**kwargs) self.code = code self.message = message @@ -1213,11 +1520,11 @@ class IPRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of IP ACL rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action - :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + :ivar action: The action of IP ACL rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - :type ip_address_or_range: str + :vartype ip_address_or_range: str """ _validation = { @@ -1236,6 +1543,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of IP ACL rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + """ super(IPRule, self).__init__(**kwargs) self.action = action self.ip_address_or_range = ip_address_or_range @@ -1246,13 +1560,13 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_identifier: Key vault uri to access the encryption key. - :type key_identifier: str + :ivar key_identifier: Key vault uri to access the encryption key. + :vartype key_identifier: str :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of the key that is actually used for encryption. :vartype versioned_key_identifier: str - :param identity: The client id of the identity which will be used to access key vault. - :type identity: str + :ivar identity: The client id of the identity which will be used to access key vault. + :vartype identity: str :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. :vartype key_rotation_enabled: bool :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. @@ -1280,6 +1594,12 @@ def __init__( identity: Optional[str] = None, **kwargs ): + """ + :keyword key_identifier: Key vault uri to access the encryption key. + :paramtype key_identifier: str + :keyword identity: The client id of the identity which will be used to access key vault. + :paramtype identity: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_identifier = key_identifier self.versioned_key_identifier = None @@ -1291,12 +1611,12 @@ def __init__( class LoggingProperties(msrest.serialization.Model): """The logging properties of the connected registry. - :param log_level: The verbosity of logs persisted on the connected registry. Possible values + :ivar log_level: The verbosity of logs persisted on the connected registry. Possible values include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". - :type log_level: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LogLevel - :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. + :vartype log_level: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LogLevel + :ivar audit_log_status: Indicates whether audit logs are enabled on the connected registry. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type audit_log_status: str or + :vartype audit_log_status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.AuditLogStatus """ @@ -1312,6 +1632,15 @@ def __init__( audit_log_status: Optional[Union[str, "AuditLogStatus"]] = "Disabled", **kwargs ): + """ + :keyword log_level: The verbosity of logs persisted on the connected registry. Possible values + include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". + :paramtype log_level: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LogLevel + :keyword audit_log_status: Indicates whether audit logs are enabled on the connected registry. + Possible values include: "Enabled", "Disabled". Default value: "Disabled". + :paramtype audit_log_status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.AuditLogStatus + """ super(LoggingProperties, self).__init__(**kwargs) self.log_level = log_level self.audit_log_status = audit_log_status @@ -1342,6 +1671,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoginServerProperties, self).__init__(**kwargs) self.host = None self.tls = None @@ -1352,15 +1683,15 @@ class NetworkRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param default_action: Required. The default action of allow or deny when no other rules match. + :ivar default_action: Required. The default action of allow or deny when no other rules match. Possible values include: "Allow", "Deny". Default value: "Allow". - :type default_action: str or + :vartype default_action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.DefaultAction - :param virtual_network_rules: The virtual network rules. - :type virtual_network_rules: + :ivar virtual_network_rules: The virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.VirtualNetworkRule] - :param ip_rules: The IP ACL rules. - :type ip_rules: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.IPRule] + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.IPRule] """ _validation = { @@ -1381,6 +1712,17 @@ def __init__( ip_rules: Optional[List["IPRule"]] = None, **kwargs ): + """ + :keyword default_action: Required. The default action of allow or deny when no other rules + match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.DefaultAction + :keyword virtual_network_rules: The virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.VirtualNetworkRule] + :keyword ip_rules: The IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.IPRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.default_action = default_action self.virtual_network_rules = virtual_network_rules @@ -1390,19 +1732,19 @@ def __init__( class OperationDefinition(msrest.serialization.Model): """The definition of a container registry operation. - :param origin: The origin information of the container registry operation. - :type origin: str - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display information for the container registry operation. - :type display: + :ivar origin: The origin information of the container registry operation. + :vartype origin: str + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationDisplayDefinition - :param is_data_action: This property indicates if the operation is an action or a data action + :ivar is_data_action: This property indicates if the operation is an action or a data action ref: https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. - :type is_data_action: bool - :param service_specification: The definition of Azure Monitoring service. - :type service_specification: + :vartype is_data_action: bool + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationServiceSpecificationDefinition """ @@ -1424,6 +1766,22 @@ def __init__( service_specification: Optional["OperationServiceSpecificationDefinition"] = None, **kwargs ): + """ + :keyword origin: The origin information of the container registry operation. + :paramtype origin: str + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationDisplayDefinition + :keyword is_data_action: This property indicates if the operation is an action or a data action + ref: + https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. + :paramtype is_data_action: bool + :keyword service_specification: The definition of Azure Monitoring service. + :paramtype service_specification: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationServiceSpecificationDefinition + """ super(OperationDefinition, self).__init__(**kwargs) self.origin = origin self.name = name @@ -1435,14 +1793,14 @@ def __init__( class OperationDisplayDefinition(msrest.serialization.Model): """The display information for a container registry operation. - :param provider: The resource provider name: Microsoft.ContainerRegistry. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that users can perform. - :type operation: str - :param description: The description for the operation. - :type description: str + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str """ _attribute_map = { @@ -1461,6 +1819,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ super(OperationDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1471,12 +1839,13 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The result of a request to list container registry operations. - :param value: The list of container registry operations. Since this list may be incomplete, the + :ivar value: The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationDefinition] - :param next_link: The URI that can be used to request the next list of container registry + :vartype value: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry operations. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1491,6 +1860,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1499,12 +1877,12 @@ def __init__( class OperationLogSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring log. - :param name: Log name. - :type name: str - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Log blob duration. - :type blob_duration: str + :ivar name: Log name. + :vartype name: str + :ivar display_name: Log display name. + :vartype display_name: str + :ivar blob_duration: Log blob duration. + :vartype blob_duration: str """ _attribute_map = { @@ -1521,6 +1899,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Log name. + :paramtype name: str + :keyword display_name: Log display name. + :paramtype display_name: str + :keyword blob_duration: Log blob duration. + :paramtype blob_duration: str + """ super(OperationLogSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1530,18 +1916,18 @@ def __init__( class OperationMetricSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring metric. - :param name: Metric name. - :type name: str - :param display_name: Metric display name. - :type display_name: str - :param display_description: Metric description. - :type display_description: str - :param unit: Metric unit. - :type unit: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param internal_metric_name: Internal metric name. - :type internal_metric_name: str + :ivar name: Metric name. + :vartype name: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -1564,6 +1950,20 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Metric name. + :paramtype name: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword unit: Metric unit. + :paramtype unit: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword internal_metric_name: Internal metric name. + :paramtype internal_metric_name: str + """ super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1576,11 +1976,11 @@ def __init__( class OperationServiceSpecificationDefinition(msrest.serialization.Model): """The definition of Azure Monitoring list. - :param metric_specifications: A list of Azure Monitoring metrics definition. - :type metric_specifications: + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationMetricSpecificationDefinition] - :param log_specifications: A list of Azure Monitoring log definitions. - :type log_specifications: + :ivar log_specifications: A list of Azure Monitoring log definitions. + :vartype log_specifications: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationLogSpecificationDefinition] """ @@ -1596,6 +1996,14 @@ def __init__( log_specifications: Optional[List["OperationLogSpecificationDefinition"]] = None, **kwargs ): + """ + :keyword metric_specifications: A list of Azure Monitoring metrics definition. + :paramtype metric_specifications: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationMetricSpecificationDefinition] + :keyword log_specifications: A list of Azure Monitoring log definitions. + :paramtype log_specifications: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationLogSpecificationDefinition] + """ super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -1606,11 +2014,11 @@ class ParentProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: The resource ID of the parent to which the connected registry will be associated. - :type id: str - :param sync_properties: Required. The sync properties of the connected registry with its - parent. - :type sync_properties: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SyncProperties + :ivar id: The resource ID of the parent to which the connected registry will be associated. + :vartype id: str + :ivar sync_properties: Required. The sync properties of the connected registry with its parent. + :vartype sync_properties: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SyncProperties """ _validation = { @@ -1629,6 +2037,14 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The resource ID of the parent to which the connected registry will be associated. + :paramtype id: str + :keyword sync_properties: Required. The sync properties of the connected registry with its + parent. + :paramtype sync_properties: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SyncProperties + """ super(ParentProperties, self).__init__(**kwargs) self.id = id self.sync_properties = sync_properties @@ -1651,13 +2067,13 @@ class PipelineRun(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param request: The request parameters for a pipeline run. - :type request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunRequest + :ivar request: The request parameters for a pipeline run. + :vartype request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunRequest :ivar response: The response of a pipeline run. :vartype response: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunResponse - :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline + :ivar force_update_tag: How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - :type force_update_tag: str + :vartype force_update_tag: str """ _validation = { @@ -1687,6 +2103,13 @@ def __init__( force_update_tag: Optional[str] = None, **kwargs ): + """ + :keyword request: The request parameters for a pipeline run. + :paramtype request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunRequest + :keyword force_update_tag: How the pipeline run should be forced to recreate even if the + pipeline run configuration has not changed. + :paramtype force_update_tag: str + """ super(PipelineRun, self).__init__(**kwargs) self.provisioning_state = None self.request = request @@ -1697,11 +2120,11 @@ def __init__( class PipelineRunListResult(msrest.serialization.Model): """The result of a request to list pipeline runs for a container registry. - :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field + :ivar value: The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] - :param next_link: The URI that can be used to request the next list of pipeline runs. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] + :ivar next_link: The URI that can be used to request the next list of pipeline runs. + :vartype next_link: str """ _attribute_map = { @@ -1716,6 +2139,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of pipeline runs. Since this list may be incomplete, the nextLink + field should be used to request the next list of pipeline runs. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] + :keyword next_link: The URI that can be used to request the next list of pipeline runs. + :paramtype next_link: str + """ super(PipelineRunListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1724,21 +2154,21 @@ def __init__( class PipelineRunRequest(msrest.serialization.Model): """The request properties provided for a pipeline run. - :param pipeline_resource_id: The resource ID of the pipeline to run. - :type pipeline_resource_id: str - :param artifacts: List of source artifacts to be transferred by the pipeline. + :ivar pipeline_resource_id: The resource ID of the pipeline to run. + :vartype pipeline_resource_id: str + :ivar artifacts: List of source artifacts to be transferred by the pipeline. Specify an image by repository ('hello-world'). This will use the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - :type artifacts: list[str] - :param source: The source properties of the pipeline run. - :type source: + :vartype artifacts: list[str] + :ivar source: The source properties of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunSourceProperties - :param target: The target properties of the pipeline run. - :type target: + :ivar target: The target properties of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str """ _attribute_map = { @@ -1759,6 +2189,23 @@ def __init__( catalog_digest: Optional[str] = None, **kwargs ): + """ + :keyword pipeline_resource_id: The resource ID of the pipeline to run. + :paramtype pipeline_resource_id: str + :keyword artifacts: List of source artifacts to be transferred by the pipeline. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype artifacts: list[str] + :keyword source: The source properties of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunSourceProperties + :keyword target: The target properties of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + """ super(PipelineRunRequest, self).__init__(**kwargs) self.pipeline_resource_id = pipeline_resource_id self.artifacts = artifacts @@ -1770,30 +2217,30 @@ def __init__( class PipelineRunResponse(msrest.serialization.Model): """The response properties returned for a pipeline run. - :param status: The current status of the pipeline run. - :type status: str - :param imported_artifacts: The artifacts imported in the pipeline run. - :type imported_artifacts: list[str] - :param progress: The current progress of the copy operation. - :type progress: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProgressProperties - :param start_time: The time the pipeline run started. - :type start_time: ~datetime.datetime - :param finish_time: The time the pipeline run finished. - :type finish_time: ~datetime.datetime - :param source: The source of the pipeline run. - :type source: + :ivar status: The current status of the pipeline run. + :vartype status: str + :ivar imported_artifacts: The artifacts imported in the pipeline run. + :vartype imported_artifacts: list[str] + :ivar progress: The current progress of the copy operation. + :vartype progress: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProgressProperties + :ivar start_time: The time the pipeline run started. + :vartype start_time: ~datetime.datetime + :ivar finish_time: The time the pipeline run finished. + :vartype finish_time: ~datetime.datetime + :ivar source: The source of the pipeline run. + :vartype source: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineSourceProperties - :param target: The target of the pipeline run. - :type target: + :ivar target: The target of the pipeline run. + :vartype target: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineTargetProperties - :param catalog_digest: The digest of the tar used to transfer the artifacts. - :type catalog_digest: str - :param trigger: The trigger that caused the pipeline run. - :type trigger: + :ivar catalog_digest: The digest of the tar used to transfer the artifacts. + :vartype catalog_digest: str + :ivar trigger: The trigger that caused the pipeline run. + :vartype trigger: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineTriggerDescriptor - :param pipeline_run_error_message: The detailed error message for the pipeline run in the case + :ivar pipeline_run_error_message: The detailed error message for the pipeline run in the case of failure. - :type pipeline_run_error_message: str + :vartype pipeline_run_error_message: str """ _attribute_map = { @@ -1824,6 +2271,33 @@ def __init__( pipeline_run_error_message: Optional[str] = None, **kwargs ): + """ + :keyword status: The current status of the pipeline run. + :paramtype status: str + :keyword imported_artifacts: The artifacts imported in the pipeline run. + :paramtype imported_artifacts: list[str] + :keyword progress: The current progress of the copy operation. + :paramtype progress: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProgressProperties + :keyword start_time: The time the pipeline run started. + :paramtype start_time: ~datetime.datetime + :keyword finish_time: The time the pipeline run finished. + :paramtype finish_time: ~datetime.datetime + :keyword source: The source of the pipeline run. + :paramtype source: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineSourceProperties + :keyword target: The target of the pipeline run. + :paramtype target: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineTargetProperties + :keyword catalog_digest: The digest of the tar used to transfer the artifacts. + :paramtype catalog_digest: str + :keyword trigger: The trigger that caused the pipeline run. + :paramtype trigger: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineTriggerDescriptor + :keyword pipeline_run_error_message: The detailed error message for the pipeline run in the + case of failure. + :paramtype pipeline_run_error_message: str + """ super(PipelineRunResponse, self).__init__(**kwargs) self.status = status self.imported_artifacts = imported_artifacts @@ -1840,12 +2314,12 @@ def __init__( class PipelineRunSourceProperties(msrest.serialization.Model): """PipelineRunSourceProperties. - :param type: The type of the source. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the source. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunSourceType - :param name: The name of the source. - :type name: str + :ivar name: The name of the source. + :vartype name: str """ _attribute_map = { @@ -1860,6 +2334,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the source. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunSourceType + :keyword name: The name of the source. + :paramtype name: str + """ super(PipelineRunSourceProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1868,12 +2350,12 @@ def __init__( class PipelineRunTargetProperties(msrest.serialization.Model): """PipelineRunTargetProperties. - :param type: The type of the target. Possible values include: "AzureStorageBlob". Default - value: "AzureStorageBlob". - :type type: str or + :ivar type: The type of the target. Possible values include: "AzureStorageBlob". Default value: + "AzureStorageBlob". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunTargetType - :param name: The name of the target. - :type name: str + :ivar name: The name of the target. + :vartype name: str """ _attribute_map = { @@ -1888,6 +2370,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of the target. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunTargetType + :keyword name: The name of the target. + :paramtype name: str + """ super(PipelineRunTargetProperties, self).__init__(**kwargs) self.type = type self.name = name @@ -1896,8 +2386,8 @@ def __init__( class PipelineSourceTriggerDescriptor(msrest.serialization.Model): """PipelineSourceTriggerDescriptor. - :param timestamp: The timestamp when the source update happened. - :type timestamp: ~datetime.datetime + :ivar timestamp: The timestamp when the source update happened. + :vartype timestamp: ~datetime.datetime """ _attribute_map = { @@ -1910,6 +2400,10 @@ def __init__( timestamp: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword timestamp: The timestamp when the source update happened. + :paramtype timestamp: ~datetime.datetime + """ super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) self.timestamp = timestamp @@ -1919,9 +2413,9 @@ class PipelineSourceTriggerProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The current status of the source trigger. Possible values include: + :ivar status: Required. The current status of the source trigger. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TriggerStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TriggerStatus """ _validation = { @@ -1938,6 +2432,12 @@ def __init__( status: Union[str, "TriggerStatus"] = "Enabled", **kwargs ): + """ + :keyword status: Required. The current status of the source trigger. Possible values include: + "Enabled", "Disabled". Default value: "Enabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TriggerStatus + """ super(PipelineSourceTriggerProperties, self).__init__(**kwargs) self.status = status @@ -1945,8 +2445,8 @@ def __init__( class PipelineTriggerDescriptor(msrest.serialization.Model): """PipelineTriggerDescriptor. - :param source_trigger: The source trigger that caused the pipeline run. - :type source_trigger: + :ivar source_trigger: The source trigger that caused the pipeline run. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceTriggerDescriptor """ @@ -1960,6 +2460,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerDescriptor"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger that caused the pipeline run. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceTriggerDescriptor + """ super(PipelineTriggerDescriptor, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1967,8 +2472,8 @@ def __init__( class PipelineTriggerProperties(msrest.serialization.Model): """PipelineTriggerProperties. - :param source_trigger: The source trigger properties of the pipeline. - :type source_trigger: + :ivar source_trigger: The source trigger properties of the pipeline. + :vartype source_trigger: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceTriggerProperties """ @@ -1982,6 +2487,11 @@ def __init__( source_trigger: Optional["PipelineSourceTriggerProperties"] = None, **kwargs ): + """ + :keyword source_trigger: The source trigger properties of the pipeline. + :paramtype source_trigger: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineSourceTriggerProperties + """ super(PipelineTriggerProperties, self).__init__(**kwargs) self.source_trigger = source_trigger @@ -1989,16 +2499,16 @@ def __init__( class Policies(msrest.serialization.Model): """The policies for a container registry. - :param quarantine_policy: The quarantine policy for a container registry. - :type quarantine_policy: + :ivar quarantine_policy: The quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.QuarantinePolicy - :param trust_policy: The content trust policy for a container registry. - :type trust_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicy - :param retention_policy: The retention policy for a container registry. - :type retention_policy: + :ivar trust_policy: The content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicy + :ivar retention_policy: The retention policy for a container registry. + :vartype retention_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RetentionPolicy - :param export_policy: The export policy for a container registry. - :type export_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPolicy + :ivar export_policy: The export policy for a container registry. + :vartype export_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPolicy """ _attribute_map = { @@ -2017,6 +2527,18 @@ def __init__( export_policy: Optional["ExportPolicy"] = None, **kwargs ): + """ + :keyword quarantine_policy: The quarantine policy for a container registry. + :paramtype quarantine_policy: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.QuarantinePolicy + :keyword trust_policy: The content trust policy for a container registry. + :paramtype trust_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicy + :keyword retention_policy: The retention policy for a container registry. + :paramtype retention_policy: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RetentionPolicy + :keyword export_policy: The export policy for a container registry. + :paramtype export_policy: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPolicy + """ super(Policies, self).__init__(**kwargs) self.quarantine_policy = quarantine_policy self.trust_policy = trust_policy @@ -2027,8 +2549,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """The Private Endpoint resource. - :param id: This is private endpoint resource created with Microsoft.Network resource provider. - :type id: str + :ivar id: This is private endpoint resource created with Microsoft.Network resource provider. + :vartype id: str """ _attribute_map = { @@ -2041,6 +2563,11 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: This is private endpoint resource created with Microsoft.Network resource + provider. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -2058,12 +2585,12 @@ class PrivateEndpointConnection(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param private_endpoint: The resource of private endpoint. - :type private_endpoint: + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of private endpoint connection resource. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". @@ -2096,6 +2623,15 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -2105,13 +2641,13 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """The result of a request to list private endpoint connections for a container registry. - :param value: The list of private endpoint connections. Since this list may be incomplete, the + :ivar value: The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - :type value: + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] - :param next_link: The URI that can be used to request the next list of private endpoint + :ivar next_link: The URI that can be used to request the next list of private endpoint connections. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2126,6 +2662,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private endpoint connections. Since this list may be incomplete, + the nextLink field should be used to request the next list of private endpoint connections. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] + :keyword next_link: The URI that can be used to request the next list of private endpoint + connections. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2138,16 +2683,16 @@ class PrivateLinkResource(msrest.serialization.Model): :ivar type: The resource type is private link resource. :vartype type: str - :param id: The resource ID. - :type id: str - :param name: The name of the resource. - :type name: str - :param group_id: The private link resource group id. - :type group_id: str - :param required_members: The private link resource required member names. - :type required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -2173,6 +2718,18 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword id: The resource ID. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.type = None self.id = id @@ -2185,11 +2742,12 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """The result of a request to list private link resources for a container registry. - :param value: The list of private link resources. Since this list may be incomplete, the + :ivar value: The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResource] - :param next_link: The URI that can be used to request the next list of private link resources. - :type next_link: str + :vartype value: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResource] + :ivar next_link: The URI that can be used to request the next list of private link resources. + :vartype next_link: str """ _attribute_map = { @@ -2204,6 +2762,15 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResource] + :keyword next_link: The URI that can be used to request the next list of private link + resources. + :paramtype next_link: str + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2212,15 +2779,16 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :param status: The private link service connection status. Possible values include: "Approved", + :ivar status: The private link service connection status. Possible values include: "Approved", "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectionStatus - :param description: The description for connection status. For example if connection is - rejected it can indicate reason for rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectionStatus + :ivar description: The description for connection status. For example if connection is rejected + it can indicate reason for rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None", "Recreate". - :type actions_required: str or + :vartype actions_required: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ActionsRequired """ @@ -2238,6 +2806,19 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: The private link service connection status. Possible values include: + "Approved", "Pending", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectionStatus + :keyword description: The description for connection status. For example if connection is + rejected it can indicate reason for rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :paramtype actions_required: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ActionsRequired + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -2247,8 +2828,8 @@ def __init__( class ProgressProperties(msrest.serialization.Model): """ProgressProperties. - :param percentage: The percentage complete of the copy operation. - :type percentage: str + :ivar percentage: The percentage complete of the copy operation. + :vartype percentage: str """ _attribute_map = { @@ -2261,6 +2842,10 @@ def __init__( percentage: Optional[str] = None, **kwargs ): + """ + :keyword percentage: The percentage complete of the copy operation. + :paramtype percentage: str + """ super(ProgressProperties, self).__init__(**kwargs) self.percentage = percentage @@ -2268,9 +2853,9 @@ def __init__( class QuarantinePolicy(msrest.serialization.Model): """The quarantine policy for a container registry. - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus """ _attribute_map = { @@ -2283,6 +2868,11 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus + """ super(QuarantinePolicy, self).__init__(**kwargs) self.status = status @@ -2292,9 +2882,9 @@ class RegenerateCredentialParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Specifies name of the password which should be regenerated -- password - or password2. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName """ _validation = { @@ -2311,6 +2901,11 @@ def __init__( name: Union[str, "PasswordName"], **kwargs ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName + """ super(RegenerateCredentialParameters, self).__init__(**kwargs) self.name = name @@ -2328,11 +2923,11 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData """ @@ -2361,6 +2956,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -2383,17 +2985,17 @@ class Registry(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param sku: Required. The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties :ivar login_server: The URL that can be used to log into the container registry. :vartype login_server: str :ivar creation_date: The creation date of the container registry in ISO8601 format. @@ -2405,16 +3007,18 @@ class Registry(Resource): ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState :ivar status: The status of the container registry at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Status - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool :ivar data_endpoint_host_names: List of host names that will serve data when dataEndpointEnabled is true. :vartype data_endpoint_host_names: list[str] @@ -2422,20 +3026,20 @@ class Registry(Resource): registry. :vartype private_endpoint_connections: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public network access is allowed for the container + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleBypassOptions - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ZoneRedundancy - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool """ _validation = { @@ -2497,6 +3101,44 @@ def __init__( anonymous_pull_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleBypassOptions + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container + registry. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ZoneRedundancy + :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :paramtype anonymous_pull_enabled: bool + """ super(Registry, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity @@ -2520,10 +3162,10 @@ def __init__( class RegistryListCredentialsResult(msrest.serialization.Model): """The response from the ListCredentials operation. - :param username: The username for a container registry. - :type username: str - :param passwords: The list of passwords for a container registry. - :type passwords: + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryPassword] """ @@ -2539,6 +3181,13 @@ def __init__( passwords: Optional[List["RegistryPassword"]] = None, **kwargs ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryPassword] + """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.username = username self.passwords = passwords @@ -2547,11 +3196,11 @@ def __init__( class RegistryListResult(msrest.serialization.Model): """The result of a request to list container registries. - :param value: The list of container registries. Since this list may be incomplete, the nextLink + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] - :param next_link: The URI that can be used to request the next list of container registries. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str """ _attribute_map = { @@ -2566,6 +3215,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ super(RegistryListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2578,8 +3234,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the container registry. - :type name: str + :ivar name: Required. The name of the container registry. + :vartype name: str :ivar type: The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". @@ -2604,6 +3260,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ super(RegistryNameCheckRequest, self).__init__(**kwargs) self.name = name @@ -2611,13 +3271,13 @@ def __init__( class RegistryNameStatus(msrest.serialization.Model): """The result of a request to check the availability of a container registry name. - :param name_available: The value that indicates whether the name is available. - :type name_available: bool - :param reason: If any, the reason that the name is not available. - :type reason: str - :param message: If any, the error message that provides more detail for the reason that the - name is not available. - :type message: str + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str """ _attribute_map = { @@ -2634,6 +3294,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ super(RegistryNameStatus, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2643,10 +3312,10 @@ def __init__( class RegistryPassword(msrest.serialization.Model): """The login password for the container registry. - :param name: The password name. Possible values include: "password", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName - :param value: The password value. - :type value: str + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName + :ivar value: The password value. + :vartype value: str """ _attribute_map = { @@ -2661,6 +3330,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ super(RegistryPassword, self).__init__(**kwargs) self.name = name self.value = value @@ -2669,32 +3344,34 @@ def __init__( class RegistryUpdateParameters(msrest.serialization.Model): """The parameters for updating a container registry. - :param identity: The identity of the container registry. - :type identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties - :param tags: A set of tags. The tags for the container registry. - :type tags: dict[str, str] - :param sku: The SKU of the container registry. - :type sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku - :param admin_user_enabled: The value that indicates whether the admin user is enabled. - :type admin_user_enabled: bool - :param network_rule_set: The network rule set for a container registry. - :type network_rule_set: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet - :param policies: The policies for a container registry. - :type policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies - :param encryption: The encryption settings of container registry. - :type encryption: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty - :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. - :type data_endpoint_enabled: bool - :param public_network_access: Whether or not public network access is allowed for the container + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool + :ivar public_network_access: Whether or not public network access is allowed for the container registry. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PublicNetworkAccess - :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network restricted registry. Possible values include: "AzureServices", "None". - :type network_rule_bypass_options: str or + :vartype network_rule_bypass_options: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleBypassOptions - :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :type anonymous_pull_enabled: bool + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool """ _attribute_map = { @@ -2727,6 +3404,37 @@ def __init__( anonymous_pull_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword identity: The identity of the container registry. + :paramtype identity: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.IdentityProperties + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.NetworkRuleBypassOptions + :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :paramtype anonymous_pull_enabled: bool + """ super(RegistryUpdateParameters, self).__init__(**kwargs) self.identity = identity self.tags = tags @@ -2744,14 +3452,15 @@ def __init__( class RegistryUsage(msrest.serialization.Model): """The quota usage for a container registry. - :param name: The name of the usage. - :type name: str - :param limit: The limit of the usage. - :type limit: long - :param current_value: The current value of the usage. - :type current_value: long - :param unit: The unit of measurement. Possible values include: "Count", "Bytes". - :type unit: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsageUnit + :ivar name: The name of the usage. + :vartype name: str + :ivar limit: The limit of the usage. + :vartype limit: long + :ivar current_value: The current value of the usage. + :vartype current_value: long + :ivar unit: The unit of measurement. Possible values include: "Count", "Bytes". + :vartype unit: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsageUnit """ _attribute_map = { @@ -2770,6 +3479,17 @@ def __init__( unit: Optional[Union[str, "RegistryUsageUnit"]] = None, **kwargs ): + """ + :keyword name: The name of the usage. + :paramtype name: str + :keyword limit: The limit of the usage. + :paramtype limit: long + :keyword current_value: The current value of the usage. + :paramtype current_value: long + :keyword unit: The unit of measurement. Possible values include: "Count", "Bytes". + :paramtype unit: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsageUnit + """ super(RegistryUsage, self).__init__(**kwargs) self.name = name self.limit = limit @@ -2780,8 +3500,8 @@ def __init__( class RegistryUsageListResult(msrest.serialization.Model): """The result of a request to get container registry quota usages. - :param value: The list of container registry quota usages. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsage] + :ivar value: The list of container registry quota usages. + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsage] """ _attribute_map = { @@ -2794,6 +3514,10 @@ def __init__( value: Optional[List["RegistryUsage"]] = None, **kwargs ): + """ + :keyword value: The list of container registry quota usages. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUsage] + """ super(RegistryUsageListResult, self).__init__(**kwargs) self.value = value @@ -2811,11 +3535,11 @@ class Replication(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData :ivar provisioning_state: The provisioning state of the replication at the time the operation @@ -2825,13 +3549,13 @@ class Replication(Resource): ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState :ivar status: The status of the replication at the time the operation was called. :vartype status: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Status - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool - :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry + :vartype region_endpoint_enabled: bool + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry replication. Possible values include: "Enabled", "Disabled". - :type zone_redundancy: str or + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ZoneRedundancy """ @@ -2867,6 +3591,21 @@ def __init__( zone_redundancy: Optional[Union[str, "ZoneRedundancy"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container registry + replication. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ZoneRedundancy + """ super(Replication, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.status = None @@ -2877,11 +3616,11 @@ def __init__( class ReplicationListResult(msrest.serialization.Model): """The result of a request to list replications for a container registry. - :param value: The list of replications. Since this list may be incomplete, the nextLink field + :ivar value: The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] - :param next_link: The URI that can be used to request the next list of replications. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] + :ivar next_link: The URI that can be used to request the next list of replications. + :vartype next_link: str """ _attribute_map = { @@ -2896,6 +3635,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] + :keyword next_link: The URI that can be used to request the next list of replications. + :paramtype next_link: str + """ super(ReplicationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2904,12 +3650,12 @@ def __init__( class ReplicationUpdateParameters(msrest.serialization.Model): """The parameters for updating a replication. - :param tags: A set of tags. The tags for the replication. - :type tags: dict[str, str] - :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + :ivar tags: A set of tags. The tags for the replication. + :vartype tags: dict[str, str] + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - :type region_endpoint_enabled: bool + :vartype region_endpoint_enabled: bool """ _attribute_map = { @@ -2924,6 +3670,14 @@ def __init__( region_endpoint_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the replication. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + """ super(ReplicationUpdateParameters, self).__init__(**kwargs) self.tags = tags self.region_endpoint_enabled = region_endpoint_enabled @@ -2932,18 +3686,18 @@ def __init__( class Request(msrest.serialization.Model): """The request that generated the event. - :param id: The ID of the request that initiated the event. - :type id: str - :param addr: The IP or hostname and possibly port of the client connection that initiated the + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - :type addr: str - :param host: The externally accessible hostname of the registry instance, as specified by the + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - :type host: str - :param method: The request method that generated the event. - :type method: str - :param useragent: The user agent header of the request. - :type useragent: str + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str """ _attribute_map = { @@ -2964,6 +3718,20 @@ def __init__( useragent: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the request that initiated the event. + :paramtype id: str + :keyword addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :paramtype addr: str + :keyword host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :paramtype host: str + :keyword method: The request method that generated the event. + :paramtype method: str + :keyword useragent: The user agent header of the request. + :paramtype useragent: str + """ super(Request, self).__init__(**kwargs) self.id = id self.addr = addr @@ -2977,13 +3745,13 @@ class RetentionPolicy(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param days: The number of days to retain an untagged manifest after which it gets purged. - :type days: int + :ivar days: The number of days to retain an untagged manifest after which it gets purged. + :vartype days: int :ivar last_updated_time: The timestamp when the policy was last updated. :vartype last_updated_time: ~datetime.datetime - :param status: The value that indicates whether the policy is enabled or not. Possible values + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus """ _validation = { @@ -3003,6 +3771,13 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword days: The number of days to retain an untagged manifest after which it gets purged. + :paramtype days: int + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus + """ super(RetentionPolicy, self).__init__(**kwargs) self.days = days self.last_updated_time = None @@ -3022,8 +3797,8 @@ class ScopeMap(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param description: The user friendly description of the scope map. - :type description: str + :ivar description: The user friendly description of the scope map. + :vartype description: str :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. :vartype type_properties_type: str :ivar creation_date: The creation date of scope map. @@ -3032,10 +3807,10 @@ class ScopeMap(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param actions: The list of scoped permissions for registry artifacts. + :ivar actions: The list of scoped permissions for registry artifacts. E.g. repositories/repository-name/content/read, repositories/repository-name/metadata/write. - :type actions: list[str] + :vartype actions: list[str] """ _validation = { @@ -3067,6 +3842,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. + :paramtype actions: list[str] + """ super(ScopeMap, self).__init__(**kwargs) self.description = description self.type_properties_type = None @@ -3078,11 +3861,11 @@ def __init__( class ScopeMapListResult(msrest.serialization.Model): """The result of a request to list scope maps for a container registry. - :param value: The list of scope maps. Since this list may be incomplete, the nextLink field + :ivar value: The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] - :param next_link: The URI that can be used to request the next list of scope maps. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] + :ivar next_link: The URI that can be used to request the next list of scope maps. + :vartype next_link: str """ _attribute_map = { @@ -3097,6 +3880,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of scope maps. Since this list may be incomplete, the nextLink field + should be used to request the next list of scope maps. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] + :keyword next_link: The URI that can be used to request the next list of scope maps. + :paramtype next_link: str + """ super(ScopeMapListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3105,12 +3895,12 @@ def __init__( class ScopeMapUpdateParameters(msrest.serialization.Model): """The properties for updating the scope map. - :param description: The user friendly description of the scope map. - :type description: str - :param actions: The list of scope permissions for registry artifacts. + :ivar description: The user friendly description of the scope map. + :vartype description: str + :ivar actions: The list of scope permissions for registry artifacts. E.g. repositories/repository-name/pull, repositories/repository-name/delete. - :type actions: list[str] + :vartype actions: list[str] """ _attribute_map = { @@ -3125,6 +3915,14 @@ def __init__( actions: Optional[List[str]] = None, **kwargs ): + """ + :keyword description: The user friendly description of the scope map. + :paramtype description: str + :keyword actions: The list of scope permissions for registry artifacts. + E.g. repositories/repository-name/pull, + repositories/repository-name/delete. + :paramtype actions: list[str] + """ super(ScopeMapUpdateParameters, self).__init__(**kwargs) self.description = description self.actions = actions @@ -3137,9 +3935,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name of the container registry. Required for registry creation. + :ivar name: Required. The SKU name of the container registry. Required for registry creation. Possible values include: "Classic", "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SkuName :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", "Standard", "Premium". :vartype tier: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SkuTier @@ -3161,6 +3959,11 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Possible values include: "Classic", "Basic", "Standard", "Premium". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -3169,11 +3972,11 @@ def __init__( class Source(msrest.serialization.Model): """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - :param addr: The IP or hostname and the port of the registry node that generated the event. + :ivar addr: The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - :type addr: str - :param instance_id: The running instance of an application. Changes after each restart. - :type instance_id: str + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str """ _attribute_map = { @@ -3188,6 +3991,13 @@ def __init__( instance_id: Optional[str] = None, **kwargs ): + """ + :keyword addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :paramtype addr: str + :keyword instance_id: The running instance of an application. Changes after each restart. + :paramtype instance_id: str + """ super(Source, self).__init__(**kwargs) self.addr = addr self.instance_id = instance_id @@ -3222,6 +4032,8 @@ def __init__( self, **kwargs ): + """ + """ super(Status, self).__init__(**kwargs) self.display_status = None self.message = None @@ -3265,6 +4077,8 @@ def __init__( self, **kwargs ): + """ + """ super(StatusDetailProperties, self).__init__(**kwargs) self.type = None self.code = None @@ -3280,19 +4094,18 @@ class SyncProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param token_id: Required. The resource ID of the ACR token used to authenticate the connected + :ivar token_id: Required. The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. - :type token_id: str - :param schedule: The cron expression indicating the schedule that the connected registry will + :vartype token_id: str + :ivar schedule: The cron expression indicating the schedule that the connected registry will sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. + :vartype schedule: str + :ivar sync_window: The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: Required. The period of time for which a message is available to sync - before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per - ISO8601. - :type message_ttl: ~datetime.timedelta + :vartype sync_window: ~datetime.timedelta + :ivar message_ttl: Required. The period of time for which a message is available to sync before + it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :vartype message_ttl: ~datetime.timedelta :ivar last_sync_time: The last time a sync occurred between the connected registry and its parent. :vartype last_sync_time: ~datetime.datetime @@ -3326,6 +4139,21 @@ def __init__( sync_window: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword token_id: Required. The resource ID of the ACR token used to authenticate the + connected registry to its parent during sync. + :paramtype token_id: str + :keyword schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :paramtype schedule: str + :keyword sync_window: The time window during which sync is enabled for each schedule + occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype sync_window: ~datetime.timedelta + :keyword message_ttl: Required. The period of time for which a message is available to sync + before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per + ISO8601. + :paramtype message_ttl: ~datetime.timedelta + """ super(SyncProperties, self).__init__(**kwargs) self.token_id = token_id self.schedule = schedule @@ -3338,15 +4166,15 @@ def __init__( class SyncUpdateProperties(msrest.serialization.Model): """The parameters for updating the sync properties of the connected registry with its parent. - :param schedule: The cron expression indicating the schedule that the connected registry will + :ivar schedule: The cron expression indicating the schedule that the connected registry will sync with its parent. - :type schedule: str - :param sync_window: The time window during which sync is enabled for each schedule occurrence. + :vartype schedule: str + :ivar sync_window: The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type sync_window: ~datetime.timedelta - :param message_ttl: The period of time for which a message is available to sync before it is + :vartype sync_window: ~datetime.timedelta + :ivar message_ttl: The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - :type message_ttl: ~datetime.timedelta + :vartype message_ttl: ~datetime.timedelta """ _attribute_map = { @@ -3363,6 +4191,17 @@ def __init__( message_ttl: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :paramtype schedule: str + :keyword sync_window: The time window during which sync is enabled for each schedule + occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype sync_window: ~datetime.timedelta + :keyword message_ttl: The period of time for which a message is available to sync before it is + expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :paramtype message_ttl: ~datetime.timedelta + """ super(SyncUpdateProperties, self).__init__(**kwargs) self.schedule = schedule self.sync_window = sync_window @@ -3372,22 +4211,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :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: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3410,6 +4249,24 @@ def __init__( 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". + :paramtype created_by_type: str or + ~azure.mgmt.containerregistry.v2021_08_01_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". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3422,24 +4279,24 @@ def __init__( class Target(msrest.serialization.Model): """The target of the event. - :param media_type: The MIME type of the referenced object. - :type media_type: str - :param size: The number of bytes of the content. Same as Length field. - :type size: long - :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. - :type digest: str - :param length: The number of bytes of the content. Same as Size field. - :type length: long - :param repository: The repository name. - :type repository: str - :param url: The direct URL to the content. - :type url: str - :param tag: The tag name. - :type tag: str - :param name: The name of the artifact. - :type name: str - :param version: The version of the artifact. - :type version: str + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: long + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: long + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str """ _attribute_map = { @@ -3468,6 +4325,27 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword media_type: The MIME type of the referenced object. + :paramtype media_type: str + :keyword size: The number of bytes of the content. Same as Length field. + :paramtype size: long + :keyword digest: The digest of the content, as defined by the Registry V2 HTTP API + Specification. + :paramtype digest: str + :keyword length: The number of bytes of the content. Same as Size field. + :paramtype length: long + :keyword repository: The repository name. + :paramtype repository: str + :keyword url: The direct URL to the content. + :paramtype url: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword name: The name of the artifact. + :paramtype name: str + :keyword version: The version of the artifact. + :paramtype version: str + """ super(Target, self).__init__(**kwargs) self.media_type = media_type self.size = size @@ -3505,6 +4383,8 @@ def __init__( self, **kwargs ): + """ + """ super(TlsCertificateProperties, self).__init__(**kwargs) self.type = None self.location = None @@ -3537,6 +4417,8 @@ def __init__( self, **kwargs ): + """ + """ super(TlsProperties, self).__init__(**kwargs) self.status = None self.certificate = None @@ -3561,15 +4443,15 @@ class Token(ProxyResource): "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ProvisioningState - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype scope_map_id: str + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCredentialsProperties - :param status: The status of the token example enabled or disabled. Possible values include: + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus """ _validation = { @@ -3601,6 +4483,17 @@ def __init__( status: Optional[Union[str, "TokenStatus"]] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCredentialsProperties + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus + """ super(Token, self).__init__(**kwargs) self.creation_date = None self.provisioning_state = None @@ -3612,16 +4505,16 @@ def __init__( class TokenCertificate(msrest.serialization.Model): """The properties of a certificate used for authenticating a token. - :param name: Possible values include: "certificate1", "certificate2". - :type name: str or + :ivar name: Possible values include: "certificate1", "certificate2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCertificateName - :param expiry: The expiry datetime of the certificate. - :type expiry: ~datetime.datetime - :param thumbprint: The thumbprint of the certificate. - :type thumbprint: str - :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format + :ivar expiry: The expiry datetime of the certificate. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The thumbprint of the certificate. + :vartype thumbprint: str + :ivar encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - :type encoded_pem_certificate: str + :vartype encoded_pem_certificate: str """ _attribute_map = { @@ -3640,6 +4533,18 @@ def __init__( encoded_pem_certificate: Optional[str] = None, **kwargs ): + """ + :keyword name: Possible values include: "certificate1", "certificate2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCertificateName + :keyword expiry: The expiry datetime of the certificate. + :paramtype expiry: ~datetime.datetime + :keyword thumbprint: The thumbprint of the certificate. + :paramtype thumbprint: str + :keyword encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM + format that will be used for authenticating the token. + :paramtype encoded_pem_certificate: str + """ super(TokenCertificate, self).__init__(**kwargs) self.name = name self.expiry = expiry @@ -3650,11 +4555,12 @@ def __init__( class TokenCredentialsProperties(msrest.serialization.Model): """The properties of the credentials that can be used for authenticating the token. - :param certificates: - :type certificates: + :ivar certificates: + :vartype certificates: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCertificate] - :param passwords: - :type passwords: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] + :ivar passwords: + :vartype passwords: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] """ _attribute_map = { @@ -3669,6 +4575,14 @@ def __init__( passwords: Optional[List["TokenPassword"]] = None, **kwargs ): + """ + :keyword certificates: + :paramtype certificates: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCertificate] + :keyword passwords: + :paramtype passwords: + list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPassword] + """ super(TokenCredentialsProperties, self).__init__(**kwargs) self.certificates = certificates self.passwords = passwords @@ -3677,11 +4591,11 @@ def __init__( class TokenListResult(msrest.serialization.Model): """The result of a request to list tokens for a container registry. - :param value: The list of tokens. Since this list may be incomplete, the nextLink field should + :ivar value: The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] - :param next_link: The URI that can be used to request the next list of tokens. - :type next_link: str + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] + :ivar next_link: The URI that can be used to request the next list of tokens. + :vartype next_link: str """ _attribute_map = { @@ -3696,6 +4610,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of tokens. Since this list may be incomplete, the nextLink field + should be used to request the next list of tokens. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] + :keyword next_link: The URI that can be used to request the next list of tokens. + :paramtype next_link: str + """ super(TokenListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3706,13 +4627,14 @@ class TokenPassword(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param creation_time: The creation datetime of the password. - :type creation_time: ~datetime.datetime - :param expiry: The expiry datetime of the password. - :type expiry: ~datetime.datetime - :param name: The password name "password1" or "password2". Possible values include: - "password1", "password2". - :type name: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName + :ivar creation_time: The creation datetime of the password. + :vartype creation_time: ~datetime.datetime + :ivar expiry: The expiry datetime of the password. + :vartype expiry: ~datetime.datetime + :ivar name: The password name "password1" or "password2". Possible values include: "password1", + "password2". + :vartype name: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName :ivar value: The password value. :vartype value: str """ @@ -3736,6 +4658,16 @@ def __init__( name: Optional[Union[str, "TokenPasswordName"]] = None, **kwargs ): + """ + :keyword creation_time: The creation datetime of the password. + :paramtype creation_time: ~datetime.datetime + :keyword expiry: The expiry datetime of the password. + :paramtype expiry: ~datetime.datetime + :keyword name: The password name "password1" or "password2". Possible values include: + "password1", "password2". + :paramtype name: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenPasswordName + """ super(TokenPassword, self).__init__(**kwargs) self.creation_time = creation_time self.expiry = expiry @@ -3746,14 +4678,14 @@ def __init__( class TokenUpdateParameters(msrest.serialization.Model): """The parameters for updating a token. - :param scope_map_id: The resource ID of the scope map to which the token will be associated + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated with. - :type scope_map_id: str - :param status: The status of the token example enabled or disabled. Possible values include: + :vartype scope_map_id: str + :ivar status: The status of the token example enabled or disabled. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus - :param credentials: The credentials that can be used for authenticating the token. - :type credentials: + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCredentialsProperties """ @@ -3771,6 +4703,17 @@ def __init__( credentials: Optional["TokenCredentialsProperties"] = None, **kwargs ): + """ + :keyword scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :paramtype scope_map_id: str + :keyword status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenStatus + :keyword credentials: The credentials that can be used for authenticating the token. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenCredentialsProperties + """ super(TokenUpdateParameters, self).__init__(**kwargs) self.scope_map_id = scope_map_id self.status = status @@ -3780,12 +4723,12 @@ def __init__( class TrustPolicy(msrest.serialization.Model): """The content trust policy for a container registry. - :param type: The type of trust policy. Possible values include: "Notary". Default value: + :ivar type: The type of trust policy. Possible values include: "Notary". Default value: "Notary". - :type type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicyType - :param status: The value that indicates whether the policy is enabled or not. Possible values + :vartype type: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus """ _attribute_map = { @@ -3800,6 +4743,15 @@ def __init__( status: Optional[Union[str, "PolicyStatus"]] = None, **kwargs ): + """ + :keyword type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :paramtype type: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TrustPolicyType + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PolicyStatus + """ super(TrustPolicy, self).__init__(**kwargs) self.type = type self.status = status @@ -3808,10 +4760,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -3826,6 +4778,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id @@ -3836,11 +4794,11 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param action: The action of virtual network rule. Possible values include: "Allow". - :type action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action - :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + :ivar action: The action of virtual network rule. Possible values include: "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action + :ivar virtual_network_resource_id: Required. Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - :type virtual_network_resource_id: str + :vartype virtual_network_resource_id: str """ _validation = { @@ -3859,6 +4817,13 @@ def __init__( action: Optional[Union[str, "Action"]] = None, **kwargs ): + """ + :keyword action: The action of virtual network rule. Possible values include: "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Action + :keyword virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :paramtype virtual_network_resource_id: str + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.action = action self.virtual_network_resource_id = virtual_network_resource_id @@ -3877,22 +4842,22 @@ class Webhook(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: Required. The location of the resource. This cannot be changed after the + :ivar location: Required. The location of the resource. This cannot be changed after the resource is created. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.SystemData - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] :ivar provisioning_state: The provisioning state of the webhook at the time the operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", @@ -3933,6 +4898,24 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] + """ super(Webhook, self).__init__(location=location, tags=tags, **kwargs) self.status = status self.scope = scope @@ -3945,24 +4928,24 @@ class WebhookCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param location: Required. The location of the webhook. This cannot be changed after the + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the webhook. This cannot be changed after the resource is created. - :type location: str - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :vartype location: str + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] """ @@ -3992,6 +4975,28 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] + """ super(WebhookCreateParameters, self).__init__(**kwargs) self.tags = tags self.location = location @@ -4005,11 +5010,11 @@ def __init__( class WebhookListResult(msrest.serialization.Model): """The result of a request to list webhooks for a container registry. - :param value: The list of webhooks. Since this list may be incomplete, the nextLink field - should be used to request the next list of webhooks. - :type value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] - :param next_link: The URI that can be used to request the next list of webhooks. - :type next_link: str + :ivar value: The list of webhooks. Since this list may be incomplete, the nextLink field should + be used to request the next list of webhooks. + :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] + :ivar next_link: The URI that can be used to request the next list of webhooks. + :vartype next_link: str """ _attribute_map = { @@ -4024,6 +5029,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] + :keyword next_link: The URI that can be used to request the next list of webhooks. + :paramtype next_link: str + """ super(WebhookListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4032,21 +5044,21 @@ def __init__( class WebhookUpdateParameters(msrest.serialization.Model): """The parameters for updating a webhook. - :param tags: A set of tags. The tags for the webhook. - :type tags: dict[str, str] - :param service_uri: The service URI for the webhook to post notifications. - :type service_uri: str - :param custom_headers: Custom headers that will be added to the webhook notifications. - :type custom_headers: dict[str, str] - :param status: The status of the webhook at the time the operation was called. Possible values + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values include: "enabled", "disabled". - :type status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus - :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + :vartype status: str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - :type scope: str - :param actions: The list of actions that trigger the webhook to post notifications. - :type actions: list[str or + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] """ @@ -4070,6 +5082,25 @@ def __init__( actions: Optional[List[Union[str, "WebhookAction"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookAction] + """ super(WebhookUpdateParameters, self).__init__(**kwargs) self.tags = tags self.service_uri = service_uri diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_connected_registries_operations.py index ef51d3997d05..f608de33d7ce 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_connected_registries_operations.py @@ -5,25 +5,270 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_deactivate_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ConnectedRegistriesOperations(object): """ConnectedRegistriesOperations operations. @@ -47,14 +292,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ConnectedRegistryListResult"] + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ConnectedRegistryListResult"]: """Lists all connected registries for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -67,8 +312,10 @@ def list( connectedRegistry parent), mode, and connectionState. The supported operator is eq. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryListResult] + :return: An iterator like instance of either ConnectedRegistryListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] @@ -76,38 +323,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + deserialized = self._deserialize("ConnectedRegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,25 +364,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> "_models.ConnectedRegistry": """Gets the properties of the connected registry. :param resource_group_name: The name of the resource group to which the container registry @@ -158,34 +403,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -194,56 +429,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_create_parameters, # type: "_models.ConnectedRegistry" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> "_models.ConnectedRegistry": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -255,17 +480,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_create_parameters, # type: "_models.ConnectedRegistry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConnectedRegistry"] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> LROPoller["_models.ConnectedRegistry"]: """Creates a connected registry for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -276,18 +503,24 @@ def begin_create( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -300,28 +533,21 @@ def begin_create( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_create_parameters=connected_registry_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -333,64 +559,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a connected registry from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -402,15 +618,17 @@ def begin_delete( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,22 +643,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -452,56 +662,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectedRegistry" + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> "_models.ConnectedRegistry": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ConnectedRegistry', pipeline_response) @@ -513,17 +712,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConnectedRegistry"] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.ConnectedRegistry"]: """Updates a connected registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -534,18 +735,24 @@ def begin_update( :param connected_registry_name: The name of the connected registry. :type connected_registry_name: str :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryUpdateParameters + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ConnectedRegistry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] lro_delay = kwargs.pop( 'polling_interval', @@ -558,28 +765,21 @@ def begin_update( registry_name=registry_name, connected_registry_name=connected_registry_name, connected_registry_update_parameters=connected_registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConnectedRegistry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -591,64 +791,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore def _deactivate_initial( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + @distributed_trace def begin_deactivate( self, - resource_group_name, # type: str - registry_name, # type: str - connected_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deactivates the connected registry instance. :param resource_group_name: The name of the resource group to which the container registry @@ -660,15 +850,17 @@ def begin_deactivate( :type connected_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -683,22 +875,14 @@ def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -710,4 +894,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_export_pipelines_operations.py index 1ac738c9f037..9d2887c89f55 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_export_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_export_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "exportPipelineName": _SERIALIZER.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ExportPipelinesOperations(object): """ExportPipelinesOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ExportPipelineListResult"]: """Lists all export pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -62,8 +214,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineListResult] + :return: An iterator like instance of either ExportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] @@ -71,36 +225,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ExportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +269,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> "_models.ExportPipeline": """Gets the properties of the export pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +302,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +327,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExportPipeline" + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> "_models.ExportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +378,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - export_pipeline_create_parameters, # type: "_models.ExportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExportPipeline"] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ExportPipeline"]: """Creates an export pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -266,18 +401,24 @@ def begin_create( :param export_pipeline_name: The name of the export pipeline. :type export_pipeline_name: str :param export_pipeline_create_parameters: The parameters for creating an export pipeline. - :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline + :type export_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ExportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ExportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +431,21 @@ def begin_create( registry_name=registry_name, export_pipeline_name=export_pipeline_name, export_pipeline_create_parameters=export_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - export_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an export pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +516,17 @@ def begin_delete( :type export_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +541,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,4 +560,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_import_pipelines_operations.py index daf44d9539c0..15aa2e540838 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_import_pipelines_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_import_pipelines_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "importPipelineName": _SERIALIZER.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class ImportPipelinesOperations(object): """ImportPipelinesOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ImportPipelineListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ImportPipelineListResult"]: """Lists all import pipelines for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -62,8 +214,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineListResult] + :return: An iterator like instance of either ImportPipelineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipelineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] @@ -71,36 +225,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + deserialized = self._deserialize("ImportPipelineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +269,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> "_models.ImportPipeline": """Gets the properties of the import pipeline. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +302,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +327,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.ImportPipeline" + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> "_models.ImportPipeline": cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +378,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - import_pipeline_create_parameters, # type: "_models.ImportPipeline" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ImportPipeline"] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> LROPoller["_models.ImportPipeline"]: """Creates an import pipeline for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -266,18 +401,24 @@ def begin_create( :param import_pipeline_name: The name of the import pipeline. :type import_pipeline_name: str :param import_pipeline_create_parameters: The parameters for creating an import pipeline. - :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline + :type import_pipeline_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ImportPipeline or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ImportPipeline or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportPipeline] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +431,21 @@ def begin_create( registry_name=registry_name, import_pipeline_name=import_pipeline_name, import_pipeline_create_parameters=import_pipeline_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ImportPipeline', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - import_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an import pipeline from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +516,17 @@ def begin_delete( :type import_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +541,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,4 +560,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_operations.py index a85d150bbc2f..a9a59443fe1a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Container Registry REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_pipeline_runs_operations.py index 38e4153c9fc9..fee065a36c6c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_pipeline_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_pipeline_runs_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "pipelineRunName": _SERIALIZER.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class PipelineRunsOperations(object): """PipelineRunsOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PipelineRunListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PipelineRunListResult"]: """Lists all the pipeline runs for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -62,8 +214,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunListResult] + :return: An iterator like instance of either PipelineRunListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRunListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] @@ -71,36 +225,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + deserialized = self._deserialize("PipelineRunListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +269,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> "_models.PipelineRun": """Gets the detailed information for a given pipeline run. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +302,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +327,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineRun" + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> "_models.PipelineRun": cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +378,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - pipeline_run_create_parameters, # type: "_models.PipelineRun" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PipelineRun"] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> LROPoller["_models.PipelineRun"]: """Creates a pipeline run for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -266,18 +401,24 @@ def begin_create( :param pipeline_run_name: The name of the pipeline run. :type pipeline_run_name: str :param pipeline_run_create_parameters: The parameters for creating a pipeline run. - :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun + :type pipeline_run_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PipelineRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PipelineRun or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PipelineRun] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +431,21 @@ def begin_create( registry_name=registry_name, pipeline_run_name=pipeline_run_name, pipeline_run_create_parameters=pipeline_run_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PipelineRun', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - pipeline_run_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a pipeline run from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +516,17 @@ def begin_delete( :type pipeline_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +541,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,4 +560,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_private_endpoint_connections_operations.py index 95a0c6e0476a..1d2c1d239846 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """List all private endpoint connections in a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -62,8 +214,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -71,36 +225,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +269,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +302,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +327,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Update the state of specified private endpoint connection associated with the container registry. @@ -267,18 +402,24 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The parameters for creating a private endpoint connection. - :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +432,21 @@ def begin_create_or_update( registry_name=registry_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,41 +458,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + 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', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -371,14 +497,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified private endpoint connection associated with the container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -390,15 +517,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -413,22 +542,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -440,4 +561,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_registries_operations.py index 26d9434a752d..5de652945aff 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_registries_operations.py @@ -5,25 +5,519 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_import_image_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_generate_credentials_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RegistriesOperations(object): """RegistriesOperations operations. @@ -49,41 +543,32 @@ def __init__(self, client, config, serializer, deserializer): def _import_image_initial( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._import_image_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImportImageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -96,14 +581,15 @@ def _import_image_initial( _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace def begin_import_image( self, - resource_group_name, # type: str - registry_name, # type: str - parameters, # type: "_models.ImportImageParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> LROPoller[None]: """Copies an image to this container registry from the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -113,18 +599,22 @@ def begin_import_image( :type registry_name: str :param parameters: The parameters specifying the image to copy and the source container registry. - :type parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportImageParameters + :type parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ImportImageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -136,24 +626,18 @@ def begin_import_image( resource_group_name=resource_group_name, registry_name=registry_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -165,20 +649,22 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + @distributed_trace def check_name_availability( self, - registry_name_check_request, # type: "_models.RegistryNameCheckRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryNameStatus" + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": """Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. :param registry_name_check_request: The object containing information for the availability request. - :type registry_name_check_request: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryNameCheckRequest + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryNameCheckRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryNameStatus, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryNameStatus @@ -189,30 +675,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -226,18 +702,21 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -245,34 +724,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -290,17 +764,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistryListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: """Lists all the container registries under the specified resource group. :param resource_group_name: The name of the resource group to which the container registry @@ -308,7 +783,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegistryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] @@ -316,35 +792,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistryListResult', pipeline_response) + deserialized = self._deserialize("RegistryListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -362,18 +834,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": """Gets the properties of the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -391,27 +864,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -425,47 +888,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry, 'Registry') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry, 'Registry') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -483,16 +937,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - registry, # type: "_models.Registry" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Creates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -504,15 +960,19 @@ def begin_create( :type registry: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -524,27 +984,21 @@ def begin_create( resource_group_name=resource_group_name, registry_name=registry_name, registry=registry, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -556,39 +1010,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -601,13 +1047,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -617,15 +1064,17 @@ def begin_delete( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -639,21 +1088,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -665,47 +1107,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registry" + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -723,16 +1155,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - registry_update_parameters, # type: "_models.RegistryUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Registry"] + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: """Updates a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -741,18 +1175,23 @@ def begin_update( :param registry_name: The name of the container registry. :type registry_name: str :param registry_update_parameters: The parameters for updating a container registry. - :type registry_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUpdateParameters + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] lro_delay = kwargs.pop( 'polling_interval', @@ -764,27 +1203,21 @@ def begin_update( resource_group_name=resource_group_name, registry_name=registry_name, registry_update_parameters=registry_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Registry', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -796,15 +1229,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + @distributed_trace def list_usages( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryUsageListResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": """Gets the quota usages for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -822,27 +1256,17 @@ def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -856,15 +1280,17 @@ def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + @distributed_trace def list_private_link_resources( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """Lists the private link resources for a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -873,8 +1299,10 @@ def list_private_link_resources( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -882,36 +1310,33 @@ def list_private_link_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_private_link_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -929,18 +1354,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources'} # type: ignore + @distributed_trace def list_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Lists the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -958,27 +1384,17 @@ def list_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -992,16 +1408,18 @@ def list_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + @distributed_trace def regenerate_credential( self, - resource_group_name, # type: str - registry_name, # type: str - regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistryListCredentialsResult" + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": """Regenerates one of the login credentials for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1011,7 +1429,8 @@ def regenerate_credential( :type registry_name: str :param regenerate_credential_parameters: Specifies name of the password which should be regenerated -- password or password2. - :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegenerateCredentialParameters + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegenerateCredentialParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryListCredentialsResult, or the result of cls(response) :rtype: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.RegistryListCredentialsResult @@ -1022,32 +1441,22 @@ def regenerate_credential( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_credential.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1061,47 +1470,38 @@ def regenerate_credential( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + def _generate_credentials_initial( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> Optional["_models.GenerateCredentialsResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateCredentialsResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_credentials_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_generate_credentials_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._generate_credentials_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1117,16 +1517,18 @@ def _generate_credentials_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + @distributed_trace def begin_generate_credentials( self, - resource_group_name, # type: str - registry_name, # type: str - generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GenerateCredentialsResult"] + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> LROPoller["_models.GenerateCredentialsResult"]: """Generate keys for a token of a specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -1135,18 +1537,24 @@ def begin_generate_credentials( :param registry_name: The name of the container registry. :type registry_name: str :param generate_credentials_parameters: The parameters for generating credentials. - :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsParameters + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.GenerateCredentialsResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1158,27 +1566,21 @@ def begin_generate_credentials( resource_group_name=resource_group_name, registry_name=registry_name, generate_credentials_parameters=generate_credentials_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1190,4 +1592,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_replications_operations.py index ad17cc2bc03e..c7651fd81bb6 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_replications_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ReplicationsOperations(object): """ReplicationsOperations operations. @@ -47,13 +245,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationListResult"]: """Lists all the replications for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -62,8 +260,10 @@ def list( :param registry_name: The name of the container registry. :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationListResult] + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] @@ -71,36 +271,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationListResult', pipeline_response) + deserialized = self._deserialize("ReplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +315,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": """Gets the properties of the specified replication. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +348,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +373,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication, 'Replication') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication, 'Replication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +424,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication, # type: "_models.Replication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Creates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -269,15 +450,20 @@ def begin_create( :type replication: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +476,21 @@ def begin_create( registry_name=registry_name, replication_name=replication_name, replication=replication, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +502,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +541,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a replication from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +561,17 @@ def begin_delete( :type replication_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +586,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,49 +605,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Replication" + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,17 +655,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - replication_name, # type: str - replication_update_parameters, # type: "_models.ReplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Replication"] + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: """Updates a replication for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -520,18 +678,24 @@ def begin_update( :param replication_name: The name of the replication. :type replication_name: str :param replication_update_parameters: The parameters for updating a replication. - :type replication_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationUpdateParameters + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ReplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Replication or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] lro_delay = kwargs.pop( 'polling_interval', @@ -544,28 +708,21 @@ def begin_update( registry_name=registry_name, replication_name=replication_name, replication_update_parameters=replication_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Replication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -577,4 +734,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_scope_maps_operations.py index 05ff6c919131..dbfbf54cb7a8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_scope_maps_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ScopeMapsOperations(object): """ScopeMapsOperations operations. @@ -47,13 +245,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScopeMapListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ScopeMapListResult"]: """Lists all the scope maps for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -63,7 +261,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] @@ -71,36 +270,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + deserialized = self._deserialize("ScopeMapListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +314,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> "_models.ScopeMap": """Gets the properties of the specified scope map. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +347,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +372,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +423,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_create_parameters, # type: "_models.ScopeMap" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Creates a scope map for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -266,18 +446,23 @@ def begin_create( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_create_parameters: The parameters for creating a scope map. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap + :type scope_map_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +475,21 @@ def begin_create( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_create_parameters=scope_map_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +501,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +540,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a scope map from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +560,17 @@ def begin_delete( :type scope_map_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +585,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,49 +604,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScopeMap" + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> "_models.ScopeMap": cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,17 +654,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - scope_map_name, # type: str - scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ScopeMap"] + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.ScopeMap"]: """Updates a scope map with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -520,18 +677,23 @@ def begin_update( :param scope_map_name: The name of the scope map. :type scope_map_name: str :param scope_map_update_parameters: The parameters for updating a scope map. - :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapUpdateParameters + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMapUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.ScopeMap] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] lro_delay = kwargs.pop( 'polling_interval', @@ -544,28 +706,21 @@ def begin_update( registry_name=registry_name, scope_map_name=scope_map_name, scope_map_update_parameters=scope_map_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ScopeMap', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -577,4 +732,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_tokens_operations.py index da8339f8925b..d053c5275637 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_tokens_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + token_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "tokenName": _SERIALIZER.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class TokensOperations(object): """TokensOperations operations. @@ -47,13 +245,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TokenListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.TokenListResult"]: """Lists all the tokens for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -63,7 +261,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TokenListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] @@ -71,36 +270,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TokenListResult', pipeline_response) + deserialized = self._deserialize("TokenListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +314,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> "_models.Token": """Gets the properties of the specified token. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +347,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +372,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(token_create_parameters, 'Token') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_create_parameters, 'Token') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +423,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_create_parameters, # type: "_models.Token" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Creates a token for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -269,15 +449,19 @@ def begin_create( :type token_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +474,21 @@ def begin_create( registry_name=registry_name, token_name=token_name, token_create_parameters=token_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +500,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +539,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a token from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +559,17 @@ def begin_delete( :type token_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +584,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,49 +603,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Token" + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> "_models.Token": cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,17 +653,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - token_name, # type: str - token_update_parameters, # type: "_models.TokenUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Token"] + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Token"]: """Updates a token with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -520,18 +676,23 @@ def begin_update( :param token_name: The name of the token. :type token_name: str :param token_update_parameters: The parameters for updating a token. - :type token_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenUpdateParameters + :type token_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.TokenUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] lro_delay = kwargs.pop( 'polling_interval', @@ -544,28 +705,21 @@ def begin_update( registry_name=registry_name, token_name=token_name, token_update_parameters=token_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Token', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -577,4 +731,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_webhooks_operations.py index b3a2953f6c12..a5a57d178d29 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_08_01_preview/operations/_webhooks_operations.py @@ -5,25 +5,334 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_ping_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_events_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_callback_config_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebhooksOperations(object): """WebhooksOperations operations. @@ -47,13 +356,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebhookListResult"] + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.WebhookListResult"]: """Lists all the webhooks for the specified container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -63,7 +372,8 @@ def list( :type registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WebhookListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] @@ -71,36 +381,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WebhookListResult', pipeline_response) + deserialized = self._deserialize("WebhookListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +425,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": """Gets the properties of the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -150,28 +458,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +483,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +534,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_create_parameters, # type: "_models.WebhookCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Creates a webhook for a container registry with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -266,18 +557,23 @@ def begin_create( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_create_parameters: The parameters for creating a webhook. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookCreateParameters + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -290,28 +586,21 @@ def begin_create( registry_name=registry_name, webhook_name=webhook_name, webhook_create_parameters=webhook_create_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -323,41 +612,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -370,14 +651,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a webhook from a container registry. :param resource_group_name: The name of the resource group to which the container registry @@ -389,15 +671,17 @@ def begin_delete( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -412,22 +696,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,49 +715,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Webhook" + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,17 +765,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - webhook_update_parameters, # type: "_models.WebhookUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Webhook"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: """Updates a webhook with the specified parameters. :param resource_group_name: The name of the resource group to which the container registry @@ -520,18 +788,23 @@ def begin_update( :param webhook_name: The name of the webhook. :type webhook_name: str :param webhook_update_parameters: The parameters for updating a webhook. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookUpdateParameters + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2021_08_01_preview.models.WebhookUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] lro_delay = kwargs.pop( 'polling_interval', @@ -544,28 +817,21 @@ def begin_update( registry_name=registry_name, webhook_name=webhook_name, webhook_update_parameters=webhook_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Webhook', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -577,16 +843,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + @distributed_trace def ping( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventInfo" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": """Triggers a ping event to be sent to the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -606,28 +873,18 @@ def ping( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.ping.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,16 +898,18 @@ def ping( return cls(pipeline_response, deserialized, {}) return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + @distributed_trace def list_events( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventListResult"] + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> Iterable["_models.EventListResult"]: """Lists recent events for the specified webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -662,7 +921,8 @@ def list_events( :type webhook_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_08_01_preview.models.EventListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] @@ -670,37 +930,35 @@ def list_events( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_events.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventListResult', pipeline_response) + deserialized = self._deserialize("EventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -718,19 +976,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_events.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'} # type: ignore + @distributed_trace def get_callback_config( self, - resource_group_name, # type: str - registry_name, # type: str - webhook_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CallbackConfig" + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": """Gets the configuration of service URI and custom headers for the webhook. :param resource_group_name: The name of the resource group to which the container registry @@ -750,28 +1009,18 @@ def get_callback_config( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_callback_config.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -785,4 +1034,6 @@ def get_callback_config( return cls(pipeline_response, deserialized, {}) return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/__init__.py new file mode 100644 index 000000000000..77e0de13a64c --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_registry_management_client import ContainerRegistryManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_configuration.py new file mode 100644 index 000000000000..b01c56907739 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_configuration.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ContainerRegistryManagementClientConfiguration(Configuration): + """Configuration for ContainerRegistryManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-09-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerregistry/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_container_registry_management_client.py new file mode 100644 index 000000000000..d131925e3aba --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_container_registry_management_client.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ContainerRegistryManagementClient: + """ContainerRegistryManagementClient. + + :ivar registries: RegistriesOperations operations + :vartype registries: azure.mgmt.containerregistry.v2021_09_01.operations.RegistriesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerregistry.v2021_09_01.operations.Operations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2021_09_01.operations.PrivateEndpointConnectionsOperations + :ivar replications: ReplicationsOperations operations + :vartype replications: + azure.mgmt.containerregistry.v2021_09_01.operations.ReplicationsOperations + :ivar webhooks: WebhooksOperations operations + :vartype webhooks: azure.mgmt.containerregistry.v2021_09_01.operations.WebhooksOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ContainerRegistryManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_metadata.json new file mode 100644 index 000000000000..1db5564d6105 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_metadata.json @@ -0,0 +1,106 @@ +{ + "chosen_version": "2021-09-01", + "total_api_version_list": ["2021-09-01"], + "client": { + "name": "ContainerRegistryManagementClient", + "filename": "_container_registry_management_client", + "description": "ContainerRegistryManagementClient.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The Microsoft Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Microsoft Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "registries": "RegistriesOperations", + "operations": "Operations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "replications": "ReplicationsOperations", + "webhooks": "WebhooksOperations" + } +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/__init__.py new file mode 100644 index 000000000000..41dd7f11c046 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_registry_management_client import ContainerRegistryManagementClient +__all__ = ['ContainerRegistryManagementClient'] + +# `._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() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_configuration.py new file mode 100644 index 000000000000..9484d3070533 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerRegistryManagementClientConfiguration(Configuration): + """Configuration for ContainerRegistryManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-09-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerregistry/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_container_registry_management_client.py new file mode 100644 index 000000000000..941074c0e014 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_container_registry_management_client.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import Operations, PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, WebhooksOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ContainerRegistryManagementClient: + """ContainerRegistryManagementClient. + + :ivar registries: RegistriesOperations operations + :vartype registries: + azure.mgmt.containerregistry.v2021_09_01.aio.operations.RegistriesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerregistry.v2021_09_01.aio.operations.Operations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerregistry.v2021_09_01.aio.operations.PrivateEndpointConnectionsOperations + :ivar replications: ReplicationsOperations operations + :vartype replications: + azure.mgmt.containerregistry.v2021_09_01.aio.operations.ReplicationsOperations + :ivar webhooks: WebhooksOperations operations + :vartype webhooks: azure.mgmt.containerregistry.v2021_09_01.aio.operations.WebhooksOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerRegistryManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerRegistryManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file 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 +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/__init__.py new file mode 100644 index 000000000000..ac77adfaf7af --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._registries_operations import RegistriesOperations +from ._operations import Operations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._replications_operations import ReplicationsOperations +from ._webhooks_operations import WebhooksOperations + +__all__ = [ + 'RegistriesOperations', + 'Operations', + 'PrivateEndpointConnectionsOperations', + 'ReplicationsOperations', + 'WebhooksOperations', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_operations.py new file mode 100644 index 000000000000..f4d629b9d729 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Azure Container Registry REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ContainerRegistry/operations'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..d13119a0a762 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,414 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """List all private endpoint connections in a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Get the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Update the state of specified private endpoint connection associated with the container + registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_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( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_registries_operations.py new file mode 100644 index 000000000000..bbaade36d317 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_registries_operations.py @@ -0,0 +1,1040 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registries_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request_initial, build_get_private_link_resource_request, build_get_request, build_import_image_request_initial, build_list_by_resource_group_request, build_list_credentials_request, build_list_private_link_resources_request, build_list_request, build_list_usages_request, build_regenerate_credential_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RegistriesOperations: + """RegistriesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _import_image_initial( + self, + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + + @distributed_trace_async + async def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Copies an image to this container registry from the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. + :type parameters: ~azure.mgmt.containerregistry.v2021_09_01.models.ImportImageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._import_image_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace_async + async def check_name_availability( + self, + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": + """Checks whether the container registry name is available for use. The name must contain only + alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + + :param registry_name_check_request: The object containing information for the availability + request. + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryNameCheckRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryNameStatus, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryNameStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryNameStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryNameStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.RegistryListResult"]: + """Lists all the container registries under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.RegistryListResult"]: + """Lists all the container registries under the specified resource group. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": + """Gets the properties of the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Registry, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.Registry + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> AsyncLROPoller["_models.Registry"]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry: The parameters for creating a container registry. + :type registry: ~azure.mgmt.containerregistry.v2021_09_01.models.Registry + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry=registry, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Registry', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Registry"]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry_update_parameters=registry_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Registry', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace_async + async def list_usages( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": + """Gets the quota usages for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryUsageListResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUsageListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryUsageListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + + @distributed_trace + def list_private_link_resources( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: + """Lists the private link resources for a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources'} # type: ignore + + @distributed_trace_async + async def get_private_link_resource( + self, + resource_group_name: str, + registry_name: str, + group_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": + """Gets a private link resource by a specified group name for a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param group_name: The name of the private link resource. + :type group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.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', {})) + + + request = build_get_private_link_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + group_name=group_name, + template_url=self.get_private_link_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_private_link_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName}'} # type: ignore + + + @distributed_trace_async + async def list_credentials( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": + """Lists the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + + @distributed_trace_async + async def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": + """Regenerates one of the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.RegenerateCredentialParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_replications_operations.py new file mode 100644 index 000000000000..ab898fdebad9 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_replications_operations.py @@ -0,0 +1,541 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._replications_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ReplicationsOperations: + """ReplicationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ReplicationListResult"]: + """Lists all the replications for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.ReplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ReplicationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": + """Gets the properties of the specified replication. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replication, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.Replication + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> AsyncLROPoller["_models.Replication"]: + """Creates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication: The parameters for creating a replication. + :type replication: ~azure.mgmt.containerregistry.v2021_09_01.models.Replication + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication=replication, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Replication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a replication from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Replication"]: + """Updates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.ReplicationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication_update_parameters=replication_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Replication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_webhooks_operations.py new file mode 100644 index 000000000000..2770b12bb18b --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/aio/operations/_webhooks_operations.py @@ -0,0 +1,733 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._webhooks_operations import build_create_request_initial, build_delete_request_initial, build_get_callback_config_request, build_get_request, build_list_events_request, build_list_request, build_ping_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebhooksOperations: + """WebhooksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WebhookListResult"]: + """Lists all the webhooks for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebhookListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.WebhookListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebhookListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": + """Gets the properties of the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Webhook, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.Webhook + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Webhook"]: + """Creates a webhook for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_create_parameters=webhook_create_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Webhook', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a webhook from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Webhook"]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_update_parameters=webhook_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Webhook', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace_async + async def ping( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": + """Triggers a ping event to be sent to the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventInfo, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.EventInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + + @distributed_trace + def list_events( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventListResult"]: + """Lists recent events for the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.EventListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EventListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_events.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'} # type: ignore + + @distributed_trace_async + async def get_callback_config( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": + """Gets the configuration of service URI and custom headers for the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CallbackConfig, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.CallbackConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CallbackConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CallbackConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/__init__.py new file mode 100644 index 000000000000..64fdecc3cc0e --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/__init__.py @@ -0,0 +1,187 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import Actor +from ._models_py3 import CallbackConfig +from ._models_py3 import EncryptionProperty +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import Event +from ._models_py3 import EventContent +from ._models_py3 import EventInfo +from ._models_py3 import EventListResult +from ._models_py3 import EventRequestMessage +from ._models_py3 import EventResponseMessage +from ._models_py3 import ExportPolicy +from ._models_py3 import IPRule +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportImageParameters +from ._models_py3 import ImportSource +from ._models_py3 import ImportSourceCredentials +from ._models_py3 import InnerErrorDescription +from ._models_py3 import KeyVaultProperties +from ._models_py3 import NetworkRuleSet +from ._models_py3 import OperationDefinition +from ._models_py3 import OperationDisplayDefinition +from ._models_py3 import OperationListResult +from ._models_py3 import OperationLogSpecificationDefinition +from ._models_py3 import OperationMetricSpecificationDefinition +from ._models_py3 import OperationServiceSpecificationDefinition +from ._models_py3 import PackageType +from ._models_py3 import Policies +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import QuarantinePolicy +from ._models_py3 import RegenerateCredentialParameters +from ._models_py3 import Registry +from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryListResult +from ._models_py3 import RegistryNameCheckRequest +from ._models_py3 import RegistryNameStatus +from ._models_py3 import RegistryPassword +from ._models_py3 import RegistryUpdateParameters +from ._models_py3 import RegistryUsage +from ._models_py3 import RegistryUsageListResult +from ._models_py3 import Replication +from ._models_py3 import ReplicationListResult +from ._models_py3 import ReplicationUpdateParameters +from ._models_py3 import Request +from ._models_py3 import Resource +from ._models_py3 import RetentionPolicy +from ._models_py3 import Sku +from ._models_py3 import Source +from ._models_py3 import Status +from ._models_py3 import StorageAccountProperties +from ._models_py3 import SystemData +from ._models_py3 import Target +from ._models_py3 import TrustPolicy +from ._models_py3 import UserIdentityProperties +from ._models_py3 import Webhook +from ._models_py3 import WebhookCreateParameters +from ._models_py3 import WebhookListResult +from ._models_py3 import WebhookUpdateParameters + + +from ._container_registry_management_client_enums import ( + Action, + ActionsRequired, + ConnectionStatus, + CreatedByType, + DefaultAction, + EncryptionStatus, + ExportPolicyStatus, + ImportMode, + LastModifiedByType, + NetworkRuleBypassOptions, + PasswordName, + PolicyStatus, + ProvisioningState, + PublicNetworkAccess, + RegistryUsageUnit, + ResourceIdentityType, + SkuName, + SkuTier, + TrustPolicyType, + WebhookAction, + WebhookStatus, + ZoneRedundancy, +) + +__all__ = [ + 'Actor', + 'CallbackConfig', + 'EncryptionProperty', + 'ErrorResponse', + 'ErrorResponseBody', + 'Event', + 'EventContent', + 'EventInfo', + 'EventListResult', + 'EventRequestMessage', + 'EventResponseMessage', + 'ExportPolicy', + 'IPRule', + 'IdentityProperties', + 'ImportImageParameters', + 'ImportSource', + 'ImportSourceCredentials', + 'InnerErrorDescription', + 'KeyVaultProperties', + 'NetworkRuleSet', + 'OperationDefinition', + 'OperationDisplayDefinition', + 'OperationListResult', + 'OperationLogSpecificationDefinition', + 'OperationMetricSpecificationDefinition', + 'OperationServiceSpecificationDefinition', + 'PackageType', + 'Policies', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'ProxyResource', + 'QuarantinePolicy', + 'RegenerateCredentialParameters', + 'Registry', + 'RegistryListCredentialsResult', + 'RegistryListResult', + 'RegistryNameCheckRequest', + 'RegistryNameStatus', + 'RegistryPassword', + 'RegistryUpdateParameters', + 'RegistryUsage', + 'RegistryUsageListResult', + 'Replication', + 'ReplicationListResult', + 'ReplicationUpdateParameters', + 'Request', + 'Resource', + 'RetentionPolicy', + 'Sku', + 'Source', + 'Status', + 'StorageAccountProperties', + 'SystemData', + 'Target', + 'TrustPolicy', + 'UserIdentityProperties', + 'Webhook', + 'WebhookCreateParameters', + 'WebhookListResult', + 'WebhookUpdateParameters', + 'Action', + 'ActionsRequired', + 'ConnectionStatus', + 'CreatedByType', + 'DefaultAction', + 'EncryptionStatus', + 'ExportPolicyStatus', + 'ImportMode', + 'LastModifiedByType', + 'NetworkRuleBypassOptions', + 'PasswordName', + 'PolicyStatus', + 'ProvisioningState', + 'PublicNetworkAccess', + 'RegistryUsageUnit', + 'ResourceIdentityType', + 'SkuName', + 'SkuTier', + 'TrustPolicyType', + 'WebhookAction', + 'WebhookStatus', + 'ZoneRedundancy', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_container_registry_management_client_enums.py new file mode 100644 index 000000000000..6de31ca4a221 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_container_registry_management_client_enums.py @@ -0,0 +1,182 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class Action(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The action of IP ACL rule. + """ + + ALLOW = "Allow" + +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """A message indicating if changes on the service provider require any updates on the consumer. + """ + + NONE = "None" + RECREATE = "Recreate" + +class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The private link service connection status. + """ + + APPROVED = "Approved" + PENDING = "Pending" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The default action of allow or deny when no other rules match. + """ + + ALLOW = "Allow" + DENY = "Deny" + +class EncryptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether or not the encryption is enabled for container registry. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ExportPolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The value that indicates whether the policy is enabled or not. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ImportMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """When Force, any existing target tags will be overwritten. When NoForce, any existing target + tags will fail the operation before any copying begins. + """ + + NO_FORCE = "NoForce" + FORCE = "Force" + +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that last modified the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether to allow trusted Azure services to access a network restricted registry. + """ + + AZURE_SERVICES = "AzureServices" + NONE = "None" + +class PasswordName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The password name. + """ + + PASSWORD = "password" + PASSWORD2 = "password2" + +class PolicyStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The value that indicates whether the policy is enabled or not. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of private endpoint connection resource. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether or not public network access is allowed for the container registry. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class RegistryUsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The unit of measurement. + """ + + COUNT = "Count" + BYTES = "Bytes" + +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU name of the container registry. Required for registry creation. + """ + + CLASSIC = "Classic" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU tier based on the SKU name. + """ + + CLASSIC = "Classic" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class TrustPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of trust policy. + """ + + NOTARY = "Notary" + +class WebhookAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + PUSH = "push" + DELETE = "delete" + QUARANTINE = "quarantine" + CHART_PUSH = "chart_push" + CHART_DELETE = "chart_delete" + +class WebhookStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The status of the webhook at the time the operation was called. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ZoneRedundancy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether or not zone redundancy is enabled for this container registry + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_models_py3.py new file mode 100644 index 000000000000..fd4e51dad753 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/models/_models_py3.py @@ -0,0 +1,3109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._container_registry_management_client_enums import * + + +class Actor(msrest.serialization.Model): + """The agent that initiated the event. For most situations, this could be from the authorization context of the request. + + :ivar name: The subject or username associated with the request context that generated the + event. + :vartype name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The subject or username associated with the request context that generated the + event. + :paramtype name: str + """ + super(Actor, self).__init__(**kwargs) + self.name = name + + +class CallbackConfig(msrest.serialization.Model): + """The configuration of service URI and custom headers for the webhook. + + All required parameters must be populated in order to send to Azure. + + :ivar service_uri: Required. The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + """ + + _validation = { + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, + } + + def __init__( + self, + *, + service_uri: str, + custom_headers: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword service_uri: Required. The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + """ + super(CallbackConfig, self).__init__(**kwargs) + self.service_uri = service_uri + self.custom_headers = custom_headers + + +class EncryptionProperty(msrest.serialization.Model): + """EncryptionProperty. + + :ivar status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.EncryptionStatus + :ivar key_vault_properties: Key vault properties. + :vartype key_vault_properties: + ~azure.mgmt.containerregistry.v2021_09_01.models.KeyVaultProperties + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "EncryptionStatus"]] = None, + key_vault_properties: Optional["KeyVaultProperties"] = None, + **kwargs + ): + """ + :keyword status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.EncryptionStatus + :keyword key_vault_properties: Key vault properties. + :paramtype key_vault_properties: + ~azure.mgmt.containerregistry.v2021_09_01.models.KeyVaultProperties + """ + super(EncryptionProperty, self).__init__(**kwargs) + self.status = status + self.key_vault_properties = key_vault_properties + + +class ErrorResponse(msrest.serialization.Model): + """An error response from the Azure Container Registry service. + + :ivar error: Azure container registry build API error body. + :vartype error: ~azure.mgmt.containerregistry.v2021_09_01.models.ErrorResponseBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseBody"] = None, + **kwargs + ): + """ + :keyword error: Azure container registry build API error body. + :paramtype error: ~azure.mgmt.containerregistry.v2021_09_01.models.ErrorResponseBody + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseBody(msrest.serialization.Model): + """An error response from the Azure Container Registry service. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str + :ivar details: an array of additional nested error response info objects, as described by this + contract. + :vartype details: list[~azure.mgmt.containerregistry.v2021_09_01.models.InnerErrorDescription] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[InnerErrorDescription]'}, + } + + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + details: Optional[List["InnerErrorDescription"]] = None, + **kwargs + ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + :keyword details: an array of additional nested error response info objects, as described by + this contract. + :paramtype details: + list[~azure.mgmt.containerregistry.v2021_09_01.models.InnerErrorDescription] + """ + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class EventInfo(msrest.serialization.Model): + """The basic information of an event. + + :ivar id: The event ID. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The event ID. + :paramtype id: str + """ + super(EventInfo, self).__init__(**kwargs) + self.id = id + + +class Event(EventInfo): + """The event for a webhook. + + :ivar id: The event ID. + :vartype id: str + :ivar event_request_message: The event request message sent to the service URI. + :vartype event_request_message: + ~azure.mgmt.containerregistry.v2021_09_01.models.EventRequestMessage + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: + ~azure.mgmt.containerregistry.v2021_09_01.models.EventResponseMessage + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, + 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + event_request_message: Optional["EventRequestMessage"] = None, + event_response_message: Optional["EventResponseMessage"] = None, + **kwargs + ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword event_request_message: The event request message sent to the service URI. + :paramtype event_request_message: + ~azure.mgmt.containerregistry.v2021_09_01.models.EventRequestMessage + :keyword event_response_message: The event response message received from the service URI. + :paramtype event_response_message: + ~azure.mgmt.containerregistry.v2021_09_01.models.EventResponseMessage + """ + super(Event, self).__init__(id=id, **kwargs) + self.event_request_message = event_request_message + self.event_response_message = event_response_message + + +class EventContent(msrest.serialization.Model): + """The content of the event request message. + + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar target: The target of the event. + :vartype target: ~azure.mgmt.containerregistry.v2021_09_01.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.v2021_09_01.models.Request + :ivar actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :vartype actor: ~azure.mgmt.containerregistry.v2021_09_01.models.Actor + :ivar source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :vartype source: ~azure.mgmt.containerregistry.v2021_09_01.models.Source + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'action': {'key': 'action', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'Target'}, + 'request': {'key': 'request', 'type': 'Request'}, + 'actor': {'key': 'actor', 'type': 'Actor'}, + 'source': {'key': 'source', 'type': 'Source'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + timestamp: Optional[datetime.datetime] = None, + action: Optional[str] = None, + target: Optional["Target"] = None, + request: Optional["Request"] = None, + actor: Optional["Actor"] = None, + source: Optional["Source"] = None, + **kwargs + ): + """ + :keyword id: The event ID. + :paramtype id: str + :keyword timestamp: The time at which the event occurred. + :paramtype timestamp: ~datetime.datetime + :keyword action: The action that encompasses the provided event. + :paramtype action: str + :keyword target: The target of the event. + :paramtype target: ~azure.mgmt.containerregistry.v2021_09_01.models.Target + :keyword request: The request that generated the event. + :paramtype request: ~azure.mgmt.containerregistry.v2021_09_01.models.Request + :keyword actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :paramtype actor: ~azure.mgmt.containerregistry.v2021_09_01.models.Actor + :keyword source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :paramtype source: ~azure.mgmt.containerregistry.v2021_09_01.models.Source + """ + super(EventContent, self).__init__(**kwargs) + self.id = id + self.timestamp = timestamp + self.action = action + self.target = target + self.request = request + self.actor = actor + self.source = source + + +class EventListResult(msrest.serialization.Model): + """The result of a request to list events for a webhook. + + :ivar value: The list of events. Since this list may be incomplete, the nextLink field should + be used to request the next list of events. + :vartype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Event] + :ivar next_link: The URI that can be used to request the next list of events. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Event]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Event"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of events. Since this list may be incomplete, the nextLink field + should be used to request the next list of events. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Event] + :keyword next_link: The URI that can be used to request the next list of events. + :paramtype next_link: str + """ + super(EventListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class EventRequestMessage(msrest.serialization.Model): + """The event request message sent to the service URI. + + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.v2021_09_01.models.EventContent + :ivar headers: The headers of the event request message. + :vartype headers: dict[str, str] + :ivar method: The HTTP method used to send the event request message. + :vartype method: str + :ivar request_uri: The URI used to send the event request message. + :vartype request_uri: str + :ivar version: The HTTP message version. + :vartype version: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'EventContent'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + 'method': {'key': 'method', 'type': 'str'}, + 'request_uri': {'key': 'requestUri', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + content: Optional["EventContent"] = None, + headers: Optional[Dict[str, str]] = None, + method: Optional[str] = None, + request_uri: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword content: The content of the event request message. + :paramtype content: ~azure.mgmt.containerregistry.v2021_09_01.models.EventContent + :keyword headers: The headers of the event request message. + :paramtype headers: dict[str, str] + :keyword method: The HTTP method used to send the event request message. + :paramtype method: str + :keyword request_uri: The URI used to send the event request message. + :paramtype request_uri: str + :keyword version: The HTTP message version. + :paramtype version: str + """ + super(EventRequestMessage, self).__init__(**kwargs) + self.content = content + self.headers = headers + self.method = method + self.request_uri = request_uri + self.version = version + + +class EventResponseMessage(msrest.serialization.Model): + """The event response message received from the service URI. + + :ivar content: The content of the event response message. + :vartype content: str + :ivar headers: The headers of the event response message. + :vartype headers: dict[str, str] + :ivar reason_phrase: The reason phrase of the event response message. + :vartype reason_phrase: str + :ivar status_code: The status code of the event response message. + :vartype status_code: str + :ivar version: The HTTP message version. + :vartype version: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'str'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + content: Optional[str] = None, + headers: Optional[Dict[str, str]] = None, + reason_phrase: Optional[str] = None, + status_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword content: The content of the event response message. + :paramtype content: str + :keyword headers: The headers of the event response message. + :paramtype headers: dict[str, str] + :keyword reason_phrase: The reason phrase of the event response message. + :paramtype reason_phrase: str + :keyword status_code: The status code of the event response message. + :paramtype status_code: str + :keyword version: The HTTP message version. + :paramtype version: str + """ + super(EventResponseMessage, self).__init__(**kwargs) + self.content = content + self.headers = headers + self.reason_phrase = reason_phrase + self.status_code = status_code + self.version = version + + +class ExportPolicy(msrest.serialization.Model): + """The export policy for a container registry. + + :ivar status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". Default value: "enabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ExportPolicyStatus + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "ExportPolicyStatus"]] = "enabled", + **kwargs + ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". Default value: "enabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ExportPolicyStatus + """ + super(ExportPolicy, self).__init__(**kwargs) + self.status = status + + +class IdentityProperties(msrest.serialization.Model): + """Managed identity for the resource. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The + user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2021_09_01.models.UserIdentityProperties] + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, + **kwargs + ): + """ + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2021_09_01.models.UserIdentityProperties] + """ + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = principal_id + self.tenant_id = tenant_id + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ImportImageParameters(msrest.serialization.Model): + """ImportImageParameters. + + All required parameters must be populated in order to send to Azure. + + :ivar source: Required. The source of the image. + :vartype source: ~azure.mgmt.containerregistry.v2021_09_01.models.ImportSource + :ivar target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + be used (or 'latest' if source tag is also omitted). + :vartype target_tags: list[str] + :ivar untagged_target_repositories: List of strings of repository names to do a manifest only + copy. No tag will be created. + :vartype untagged_target_repositories: list[str] + :ivar mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :vartype mode: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ImportMode + """ + + _validation = { + 'source': {'required': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'ImportSource'}, + 'target_tags': {'key': 'targetTags', 'type': '[str]'}, + 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, + 'mode': {'key': 'mode', 'type': 'str'}, + } + + def __init__( + self, + *, + source: "ImportSource", + target_tags: Optional[List[str]] = None, + untagged_target_repositories: Optional[List[str]] = None, + mode: Optional[Union[str, "ImportMode"]] = "NoForce", + **kwargs + ): + """ + :keyword source: Required. The source of the image. + :paramtype source: ~azure.mgmt.containerregistry.v2021_09_01.models.ImportSource + :keyword target_tags: List of strings of the form repo[:tag]. When tag is omitted the source + will be used (or 'latest' if source tag is also omitted). + :paramtype target_tags: list[str] + :keyword untagged_target_repositories: List of strings of repository names to do a manifest + only copy. No tag will be created. + :paramtype untagged_target_repositories: list[str] + :keyword mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :paramtype mode: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ImportMode + """ + super(ImportImageParameters, self).__init__(**kwargs) + self.source = source + self.target_tags = target_tags + self.untagged_target_repositories = untagged_target_repositories + self.mode = mode + + +class ImportSource(msrest.serialization.Model): + """ImportSource. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: The resource identifier of the source Azure Container Registry. + :vartype resource_id: str + :ivar registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :vartype registry_uri: str + :ivar credentials: Credentials used when importing from a registry uri. + :vartype credentials: ~azure.mgmt.containerregistry.v2021_09_01.models.ImportSourceCredentials + :ivar source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :vartype source_image: str + """ + + _validation = { + 'source_image': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'registry_uri': {'key': 'registryUri', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, + 'source_image': {'key': 'sourceImage', 'type': 'str'}, + } + + def __init__( + self, + *, + source_image: str, + resource_id: Optional[str] = None, + registry_uri: Optional[str] = None, + credentials: Optional["ImportSourceCredentials"] = None, + **kwargs + ): + """ + :keyword resource_id: The resource identifier of the source Azure Container Registry. + :paramtype resource_id: str + :keyword registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :paramtype registry_uri: str + :keyword credentials: Credentials used when importing from a registry uri. + :paramtype credentials: + ~azure.mgmt.containerregistry.v2021_09_01.models.ImportSourceCredentials + :keyword source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :paramtype source_image: str + """ + super(ImportSource, self).__init__(**kwargs) + self.resource_id = resource_id + self.registry_uri = registry_uri + self.credentials = credentials + self.source_image = source_image + + +class ImportSourceCredentials(msrest.serialization.Model): + """ImportSourceCredentials. + + All required parameters must be populated in order to send to Azure. + + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: Required. The password used to authenticate with the source registry. + :vartype password: str + """ + + _validation = { + 'password': {'required': True}, + } + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + *, + password: str, + username: Optional[str] = None, + **kwargs + ): + """ + :keyword username: The username to authenticate with the source registry. + :paramtype username: str + :keyword password: Required. The password used to authenticate with the source registry. + :paramtype password: str + """ + super(ImportSourceCredentials, self).__init__(**kwargs) + self.username = username + self.password = password + + +class InnerErrorDescription(msrest.serialization.Model): + """inner error. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str + :ivar target: target of the particular error. + :vartype target: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + **kwargs + ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + :keyword target: target of the particular error. + :paramtype target: str + """ + super(InnerErrorDescription, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + + +class IPRule(msrest.serialization.Model): + """IP rule with specific IP or IP range in CIDR format. + + All required parameters must be populated in order to send to Azure. + + :ivar action: The action of IP ACL rule. Possible values include: "Allow". Default value: + "Allow". + :vartype action: str or ~azure.mgmt.containerregistry.v2021_09_01.models.Action + :ivar ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :vartype ip_address_or_range: str + """ + + _validation = { + 'ip_address_or_range': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'ip_address_or_range': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_address_or_range: str, + action: Optional[Union[str, "Action"]] = "Allow", + **kwargs + ): + """ + :keyword action: The action of IP ACL rule. Possible values include: "Allow". Default value: + "Allow". + :paramtype action: str or ~azure.mgmt.containerregistry.v2021_09_01.models.Action + :keyword ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :paramtype ip_address_or_range: str + """ + super(IPRule, self).__init__(**kwargs) + self.action = action + self.ip_address_or_range = ip_address_or_range + + +class KeyVaultProperties(msrest.serialization.Model): + """KeyVaultProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key_identifier: Key vault uri to access the encryption key. + :vartype key_identifier: str + :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of + the key that is actually used for encryption. + :vartype versioned_key_identifier: str + :ivar identity: The client id of the identity which will be used to access key vault. + :vartype identity: str + :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. + :vartype key_rotation_enabled: bool + :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. + :vartype last_key_rotation_timestamp: ~datetime.datetime + """ + + _validation = { + 'versioned_key_identifier': {'readonly': True}, + 'key_rotation_enabled': {'readonly': True}, + 'last_key_rotation_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'versioned_key_identifier': {'key': 'versionedKeyIdentifier', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, + 'key_rotation_enabled': {'key': 'keyRotationEnabled', 'type': 'bool'}, + 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + key_identifier: Optional[str] = None, + identity: Optional[str] = None, + **kwargs + ): + """ + :keyword key_identifier: Key vault uri to access the encryption key. + :paramtype key_identifier: str + :keyword identity: The client id of the identity which will be used to access key vault. + :paramtype identity: str + """ + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_identifier = key_identifier + self.versioned_key_identifier = None + self.identity = identity + self.key_rotation_enabled = None + self.last_key_rotation_timestamp = None + + +class NetworkRuleSet(msrest.serialization.Model): + """The network rule set for a container registry. + + All required parameters must be populated in order to send to Azure. + + :ivar default_action: Required. The default action of allow or deny when no other rules match. + Possible values include: "Allow", "Deny". Default value: "Allow". + :vartype default_action: str or ~azure.mgmt.containerregistry.v2021_09_01.models.DefaultAction + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.v2021_09_01.models.IPRule] + """ + + _validation = { + 'default_action': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + } + + def __init__( + self, + *, + default_action: Union[str, "DefaultAction"] = "Allow", + ip_rules: Optional[List["IPRule"]] = None, + **kwargs + ): + """ + :keyword default_action: Required. The default action of allow or deny when no other rules + match. Possible values include: "Allow", "Deny". Default value: "Allow". + :paramtype default_action: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.DefaultAction + :keyword ip_rules: The IP ACL rules. + :paramtype ip_rules: list[~azure.mgmt.containerregistry.v2021_09_01.models.IPRule] + """ + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = default_action + self.ip_rules = ip_rules + + +class OperationDefinition(msrest.serialization.Model): + """The definition of a container registry operation. + + :ivar origin: The origin information of the container registry operation. + :vartype origin: str + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display information for the container registry operation. + :vartype display: ~azure.mgmt.containerregistry.v2021_09_01.models.OperationDisplayDefinition + :ivar is_data_action: This property indicates if the operation is an action or a data action + ref: + https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. + :vartype is_data_action: bool + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: + ~azure.mgmt.containerregistry.v2021_09_01.models.OperationServiceSpecificationDefinition + """ + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, + } + + def __init__( + self, + *, + origin: Optional[str] = None, + name: Optional[str] = None, + display: Optional["OperationDisplayDefinition"] = None, + is_data_action: Optional[bool] = None, + service_specification: Optional["OperationServiceSpecificationDefinition"] = None, + **kwargs + ): + """ + :keyword origin: The origin information of the container registry operation. + :paramtype origin: str + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display information for the container registry operation. + :paramtype display: ~azure.mgmt.containerregistry.v2021_09_01.models.OperationDisplayDefinition + :keyword is_data_action: This property indicates if the operation is an action or a data action + ref: + https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. + :paramtype is_data_action: bool + :keyword service_specification: The definition of Azure Monitoring service. + :paramtype service_specification: + ~azure.mgmt.containerregistry.v2021_09_01.models.OperationServiceSpecificationDefinition + """ + super(OperationDefinition, self).__init__(**kwargs) + self.origin = origin + self.name = name + self.display = display + self.is_data_action = is_data_action + self.service_specification = service_specification + + +class OperationDisplayDefinition(msrest.serialization.Model): + """The display information for a container registry operation. + + :ivar provider: The resource provider name: Microsoft.ContainerRegistry. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: The resource provider name: Microsoft.ContainerRegistry. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that users can perform. + :paramtype operation: str + :keyword description: The description for the operation. + :paramtype description: str + """ + super(OperationDisplayDefinition, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """The result of a request to list container registry operations. + + :ivar value: The list of container registry operations. Since this list may be incomplete, the + nextLink field should be used to request the next list of operations. + :vartype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.OperationDefinition] + :ivar next_link: The URI that can be used to request the next list of container registry + operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of container registry operations. Since this list may be incomplete, + the nextLink field should be used to request the next list of operations. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.OperationDefinition] + :keyword next_link: The URI that can be used to request the next list of container registry + operations. + :paramtype next_link: str + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationLogSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring log. + + :ivar name: Log name. + :vartype name: str + :ivar display_name: Log display name. + :vartype display_name: str + :ivar blob_duration: Log blob duration. + :vartype blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Log name. + :paramtype name: str + :keyword display_name: Log display name. + :paramtype display_name: str + :keyword blob_duration: Log blob duration. + :paramtype blob_duration: str + """ + super(OperationLogSpecificationDefinition, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class OperationMetricSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring metric. + + :ivar name: Metric name. + :vartype name: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + internal_metric_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Metric name. + :paramtype name: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword unit: Metric unit. + :paramtype unit: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword internal_metric_name: Internal metric name. + :paramtype internal_metric_name: str + """ + super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.internal_metric_name = internal_metric_name + + +class OperationServiceSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring list. + + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: + list[~azure.mgmt.containerregistry.v2021_09_01.models.OperationMetricSpecificationDefinition] + :ivar log_specifications: A list of Azure Monitoring log definitions. + :vartype log_specifications: + list[~azure.mgmt.containerregistry.v2021_09_01.models.OperationLogSpecificationDefinition] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecificationDefinition]'}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["OperationMetricSpecificationDefinition"]] = None, + log_specifications: Optional[List["OperationLogSpecificationDefinition"]] = None, + **kwargs + ): + """ + :keyword metric_specifications: A list of Azure Monitoring metrics definition. + :paramtype metric_specifications: + list[~azure.mgmt.containerregistry.v2021_09_01.models.OperationMetricSpecificationDefinition] + :keyword log_specifications: A list of Azure Monitoring log definitions. + :paramtype log_specifications: + list[~azure.mgmt.containerregistry.v2021_09_01.models.OperationLogSpecificationDefinition] + """ + super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + self.log_specifications = log_specifications + + +class PackageType(msrest.serialization.Model): + """The properties of a package type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the package type. + :vartype name: str + :ivar endpoint: The endpoint of the package type. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of the package type. + :paramtype name: str + """ + super(PackageType, self).__init__(**kwargs) + self.name = name + self.endpoint = None + + +class Policies(msrest.serialization.Model): + """The policies for a container registry. + + :ivar quarantine_policy: The quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.QuarantinePolicy + :ivar trust_policy: The content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.TrustPolicy + :ivar retention_policy: The retention policy for a container registry. + :vartype retention_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.RetentionPolicy + :ivar export_policy: The export policy for a container registry. + :vartype export_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.ExportPolicy + """ + + _attribute_map = { + 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, + 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + 'export_policy': {'key': 'exportPolicy', 'type': 'ExportPolicy'}, + } + + def __init__( + self, + *, + quarantine_policy: Optional["QuarantinePolicy"] = None, + trust_policy: Optional["TrustPolicy"] = None, + retention_policy: Optional["RetentionPolicy"] = None, + export_policy: Optional["ExportPolicy"] = None, + **kwargs + ): + """ + :keyword quarantine_policy: The quarantine policy for a container registry. + :paramtype quarantine_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.QuarantinePolicy + :keyword trust_policy: The content trust policy for a container registry. + :paramtype trust_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.TrustPolicy + :keyword retention_policy: The retention policy for a container registry. + :paramtype retention_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.RetentionPolicy + :keyword export_policy: The export policy for a container registry. + :paramtype export_policy: ~azure.mgmt.containerregistry.v2021_09_01.models.ExportPolicy + """ + super(Policies, self).__init__(**kwargs) + self.quarantine_policy = quarantine_policy + self.trust_policy = trust_policy + self.retention_policy = retention_policy + self.export_policy = export_policy + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + :ivar id: This is private endpoint resource created with Microsoft.Network resource provider. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: This is private endpoint resource created with Microsoft.Network resource + provider. + :paramtype id: str + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class ProxyResource(msrest.serialization.Model): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_09_01.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class PrivateEndpointConnection(ProxyResource): + """An object that represents a private endpoint connection for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_09_01.models.SystemData + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2021_09_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of private endpoint connection resource. + Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: ~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2021_09_01.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """The result of a request to list private endpoint connections for a container registry. + + :ivar value: The list of private endpoint connections. Since this list may be incomplete, the + nextLink field should be used to request the next list of private endpoint connections. + :vartype value: + list[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpointConnection] + :ivar next_link: The URI that can be used to request the next list of private endpoint + connections. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of private endpoint connections. Since this list may be incomplete, + the nextLink field should be used to request the next list of private endpoint connections. + :paramtype value: + list[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpointConnection] + :keyword next_link: The URI that can be used to request the next list of private endpoint + connections. + :paramtype next_link: str + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(msrest.serialization.Model): + """A resource that supports private link capabilities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The resource type is private link resource. + :vartype type: str + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword id: The resource ID. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.type = None + self.id = id + self.name = name + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """The result of a request to list private link resources for a container registry. + + :ivar value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :vartype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateLinkResource] + :ivar next_link: The URI that can be used to request the next list of private link resources. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateLinkResource] + :keyword next_link: The URI that can be used to request the next list of private link + resources. + :paramtype next_link: str + """ + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The state of a private link service connection. + + :ivar status: The private link service connection status. Possible values include: "Approved", + "Pending", "Rejected", "Disconnected". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ConnectionStatus + :ivar description: The description for connection status. For example if connection is rejected + it can indicate reason for rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :vartype actions_required: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "ConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "ActionsRequired"]] = None, + **kwargs + ): + """ + :keyword status: The private link service connection status. Possible values include: + "Approved", "Pending", "Rejected", "Disconnected". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.ConnectionStatus + :keyword description: The description for connection status. For example if connection is + rejected it can indicate reason for rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :paramtype actions_required: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ActionsRequired + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class QuarantinePolicy(msrest.serialization.Model): + """The quarantine policy for a container registry. + + :ivar status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PolicyStatus + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PolicyStatus"]] = None, + **kwargs + ): + """ + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PolicyStatus + """ + super(QuarantinePolicy, self).__init__(**kwargs) + self.status = status + + +class RegenerateCredentialParameters(msrest.serialization.Model): + """The parameters used to regenerate the login credential. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Specifies name of the password which should be regenerated -- password or + password2. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PasswordName + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "PasswordName"], + **kwargs + ): + """ + :keyword name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PasswordName + """ + super(RegenerateCredentialParameters, self).__init__(**kwargs) + self.name = name + + +class Resource(msrest.serialization.Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: Required. The location of the resource. This cannot be changed after the + resource is created. + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_09_01.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.system_data = None + + +class Registry(Resource): + """An object that represents a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: Required. The location of the resource. This cannot be changed after the + resource is created. + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_09_01.models.SystemData + :ivar sku: Required. The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2021_09_01.models.Sku + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2021_09_01.models.IdentityProperties + :ivar login_server: The URL that can be used to log into the container registry. + :vartype login_server: str + :ivar creation_date: The creation date of the container registry in ISO8601 format. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the container registry at the time the + operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", + "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ProvisioningState + :ivar status: The status of the container registry at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.v2021_09_01.models.Status + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2021_09_01.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: ~azure.mgmt.containerregistry.v2021_09_01.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool + :ivar data_endpoint_host_names: List of host names that will serve data when + dataEndpointEnabled is true. + :vartype data_endpoint_host_names: list[str] + :ivar private_endpoint_connections: List of private endpoint connections for a container + registry. + :vartype private_endpoint_connections: + list[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpointConnection] + :ivar public_network_access: Whether or not public network access is allowed for the container + registry. Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.PublicNetworkAccess + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Possible values include: "AzureServices", "None". + :vartype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleBypassOptions + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry. + Possible values include: "Enabled", "Disabled". + :vartype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ZoneRedundancy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'sku': {'required': True}, + 'login_server': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'data_endpoint_host_names': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, + 'data_endpoint_host_names': {'key': 'properties.dataEndpointHostNames', 'type': '[str]'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, + 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + sku: "Sku", + tags: Optional[Dict[str, str]] = None, + identity: Optional["IdentityProperties"] = None, + admin_user_enabled: Optional[bool] = False, + network_rule_set: Optional["NetworkRuleSet"] = None, + policies: Optional["Policies"] = None, + encryption: Optional["EncryptionProperty"] = None, + data_endpoint_enabled: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + network_rule_bypass_options: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + zone_redundancy: Optional[Union[str, "ZoneRedundancy"]] = None, + **kwargs + ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword sku: Required. The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2021_09_01.models.Sku + :keyword identity: The identity of the container registry. + :paramtype identity: ~azure.mgmt.containerregistry.v2021_09_01.models.IdentityProperties + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2021_09_01.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: ~azure.mgmt.containerregistry.v2021_09_01.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleBypassOptions + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container + registry. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ZoneRedundancy + """ + super(Registry, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.login_server = None + self.creation_date = None + self.provisioning_state = None + self.status = None + self.admin_user_enabled = admin_user_enabled + self.network_rule_set = network_rule_set + self.policies = policies + self.encryption = encryption + self.data_endpoint_enabled = data_endpoint_enabled + self.data_endpoint_host_names = None + self.private_endpoint_connections = None + self.public_network_access = public_network_access + self.network_rule_bypass_options = network_rule_bypass_options + self.zone_redundancy = zone_redundancy + + +class RegistryListCredentialsResult(msrest.serialization.Model): + """The response from the ListCredentials operation. + + :ivar username: The username for a container registry. + :vartype username: str + :ivar passwords: The list of passwords for a container registry. + :vartype passwords: list[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryPassword] + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + passwords: Optional[List["RegistryPassword"]] = None, + **kwargs + ): + """ + :keyword username: The username for a container registry. + :paramtype username: str + :keyword passwords: The list of passwords for a container registry. + :paramtype passwords: list[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryPassword] + """ + super(RegistryListCredentialsResult, self).__init__(**kwargs) + self.username = username + self.passwords = passwords + + +class RegistryListResult(msrest.serialization.Model): + """The result of a request to list container registries. + + :ivar value: The list of container registries. Since this list may be incomplete, the nextLink + field should be used to request the next list of container registries. + :vartype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Registry] + :ivar next_link: The URI that can be used to request the next list of container registries. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Registry]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Registry"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of container registries. Since this list may be incomplete, the + nextLink field should be used to request the next list of container registries. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Registry] + :keyword next_link: The URI that can be used to request the next list of container registries. + :paramtype next_link: str + """ + super(RegistryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RegistryNameCheckRequest(msrest.serialization.Model): + """A request to check whether a container registry name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the container registry. + :vartype name: str + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: + "Microsoft.ContainerRegistry/registries". + :vartype type: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.ContainerRegistry/registries" + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. The name of the container registry. + :paramtype name: str + """ + super(RegistryNameCheckRequest, self).__init__(**kwargs) + self.name = name + + +class RegistryNameStatus(msrest.serialization.Model): + """The result of a request to check the availability of a container registry name. + + :ivar name_available: The value that indicates whether the name is available. + :vartype name_available: bool + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword name_available: The value that indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: If any, the reason that the name is not available. + :paramtype reason: str + :keyword message: If any, the error message that provides more detail for the reason that the + name is not available. + :paramtype message: str + """ + super(RegistryNameStatus, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class RegistryPassword(msrest.serialization.Model): + """The login password for the container registry. + + :ivar name: The password name. Possible values include: "password", "password2". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PasswordName + :ivar value: The password value. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "PasswordName"]] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The password name. Possible values include: "password", "password2". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PasswordName + :keyword value: The password value. + :paramtype value: str + """ + super(RegistryPassword, self).__init__(**kwargs) + self.name = name + self.value = value + + +class RegistryUpdateParameters(msrest.serialization.Model): + """The parameters for updating a container registry. + + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.v2021_09_01.models.IdentityProperties + :ivar tags: A set of tags. The tags for the container registry. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the container registry. + :vartype sku: ~azure.mgmt.containerregistry.v2021_09_01.models.Sku + :ivar admin_user_enabled: The value that indicates whether the admin user is enabled. + :vartype admin_user_enabled: bool + :ivar network_rule_set: The network rule set for a container registry. + :vartype network_rule_set: ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.v2021_09_01.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: ~azure.mgmt.containerregistry.v2021_09_01.models.EncryptionProperty + :ivar data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :vartype data_endpoint_enabled: bool + :ivar public_network_access: Whether or not public network access is allowed for the container + registry. Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.PublicNetworkAccess + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Possible values include: "AzureServices", "None". + :vartype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleBypassOptions + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, + } + + def __init__( + self, + *, + identity: Optional["IdentityProperties"] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + admin_user_enabled: Optional[bool] = None, + network_rule_set: Optional["NetworkRuleSet"] = None, + policies: Optional["Policies"] = None, + encryption: Optional["EncryptionProperty"] = None, + data_endpoint_enabled: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + network_rule_bypass_options: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + **kwargs + ): + """ + :keyword identity: The identity of the container registry. + :paramtype identity: ~azure.mgmt.containerregistry.v2021_09_01.models.IdentityProperties + :keyword tags: A set of tags. The tags for the container registry. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the container registry. + :paramtype sku: ~azure.mgmt.containerregistry.v2021_09_01.models.Sku + :keyword admin_user_enabled: The value that indicates whether the admin user is enabled. + :paramtype admin_user_enabled: bool + :keyword network_rule_set: The network rule set for a container registry. + :paramtype network_rule_set: ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleSet + :keyword policies: The policies for a container registry. + :paramtype policies: ~azure.mgmt.containerregistry.v2021_09_01.models.Policies + :keyword encryption: The encryption settings of container registry. + :paramtype encryption: ~azure.mgmt.containerregistry.v2021_09_01.models.EncryptionProperty + :keyword data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :paramtype data_endpoint_enabled: bool + :keyword public_network_access: Whether or not public network access is allowed for the + container registry. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.PublicNetworkAccess + :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a + network restricted registry. Possible values include: "AzureServices", "None". + :paramtype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.NetworkRuleBypassOptions + """ + super(RegistryUpdateParameters, self).__init__(**kwargs) + self.identity = identity + self.tags = tags + self.sku = sku + self.admin_user_enabled = admin_user_enabled + self.network_rule_set = network_rule_set + self.policies = policies + self.encryption = encryption + self.data_endpoint_enabled = data_endpoint_enabled + self.public_network_access = public_network_access + self.network_rule_bypass_options = network_rule_bypass_options + + +class RegistryUsage(msrest.serialization.Model): + """The quota usage for a container registry. + + :ivar name: The name of the usage. + :vartype name: str + :ivar limit: The limit of the usage. + :vartype limit: long + :ivar current_value: The current value of the usage. + :vartype current_value: long + :ivar unit: The unit of measurement. Possible values include: "Count", "Bytes". + :vartype unit: str or ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUsageUnit + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + limit: Optional[int] = None, + current_value: Optional[int] = None, + unit: Optional[Union[str, "RegistryUsageUnit"]] = None, + **kwargs + ): + """ + :keyword name: The name of the usage. + :paramtype name: str + :keyword limit: The limit of the usage. + :paramtype limit: long + :keyword current_value: The current value of the usage. + :paramtype current_value: long + :keyword unit: The unit of measurement. Possible values include: "Count", "Bytes". + :paramtype unit: str or ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUsageUnit + """ + super(RegistryUsage, self).__init__(**kwargs) + self.name = name + self.limit = limit + self.current_value = current_value + self.unit = unit + + +class RegistryUsageListResult(msrest.serialization.Model): + """The result of a request to get container registry quota usages. + + :ivar value: The list of container registry quota usages. + :vartype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUsage] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RegistryUsage]'}, + } + + def __init__( + self, + *, + value: Optional[List["RegistryUsage"]] = None, + **kwargs + ): + """ + :keyword value: The list of container registry quota usages. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUsage] + """ + super(RegistryUsageListResult, self).__init__(**kwargs) + self.value = value + + +class Replication(Resource): + """An object that represents a replication for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: Required. The location of the resource. This cannot be changed after the + resource is created. + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_09_01.models.SystemData + :ivar provisioning_state: The provisioning state of the replication at the time the operation + was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ProvisioningState + :ivar status: The status of the replication at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.v2021_09_01.models.Status + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :vartype region_endpoint_enabled: bool + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry + replication. Possible values include: "Enabled", "Disabled". + :vartype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ZoneRedundancy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, + 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + region_endpoint_enabled: Optional[bool] = True, + zone_redundancy: Optional[Union[str, "ZoneRedundancy"]] = None, + **kwargs + ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container registry + replication. Possible values include: "Enabled", "Disabled". + :paramtype zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ZoneRedundancy + """ + super(Replication, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.status = None + self.region_endpoint_enabled = region_endpoint_enabled + self.zone_redundancy = zone_redundancy + + +class ReplicationListResult(msrest.serialization.Model): + """The result of a request to list replications for a container registry. + + :ivar value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :vartype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Replication] + :ivar next_link: The URI that can be used to request the next list of replications. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Replication]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Replication"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Replication] + :keyword next_link: The URI that can be used to request the next list of replications. + :paramtype next_link: str + """ + super(ReplicationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ReplicationUpdateParameters(msrest.serialization.Model): + """The parameters for updating a replication. + + :ivar tags: A set of tags. The tags for the replication. + :vartype tags: dict[str, str] + :ivar region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :vartype region_endpoint_enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + region_endpoint_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The tags for the replication. + :paramtype tags: dict[str, str] + :keyword region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :paramtype region_endpoint_enabled: bool + """ + super(ReplicationUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.region_endpoint_enabled = region_endpoint_enabled + + +class Request(msrest.serialization.Model): + """The request that generated the event. + + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'addr': {'key': 'addr', 'type': 'str'}, + 'host': {'key': 'host', 'type': 'str'}, + 'method': {'key': 'method', 'type': 'str'}, + 'useragent': {'key': 'useragent', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + addr: Optional[str] = None, + host: Optional[str] = None, + method: Optional[str] = None, + useragent: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The ID of the request that initiated the event. + :paramtype id: str + :keyword addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :paramtype addr: str + :keyword host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :paramtype host: str + :keyword method: The request method that generated the event. + :paramtype method: str + :keyword useragent: The user agent header of the request. + :paramtype useragent: str + """ + super(Request, self).__init__(**kwargs) + self.id = id + self.addr = addr + self.host = host + self.method = method + self.useragent = useragent + + +class RetentionPolicy(msrest.serialization.Model): + """The retention policy for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar days: The number of days to retain an untagged manifest after which it gets purged. + :vartype days: int + :ivar last_updated_time: The timestamp when the policy was last updated. + :vartype last_updated_time: ~datetime.datetime + :ivar status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PolicyStatus + """ + + _validation = { + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'days': {'key': 'days', 'type': 'int'}, + 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + days: Optional[int] = 7, + status: Optional[Union[str, "PolicyStatus"]] = None, + **kwargs + ): + """ + :keyword days: The number of days to retain an untagged manifest after which it gets purged. + :paramtype days: int + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PolicyStatus + """ + super(RetentionPolicy, self).__init__(**kwargs) + self.days = days + self.last_updated_time = None + self.status = status + + +class Sku(msrest.serialization.Model): + """The SKU of a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The SKU name of the container registry. Required for registry creation. + Possible values include: "Classic", "Basic", "Standard", "Premium". + :vartype name: str or ~azure.mgmt.containerregistry.v2021_09_01.models.SkuName + :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", + "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.containerregistry.v2021_09_01.models.SkuTier + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): + """ + :keyword name: Required. The SKU name of the container registry. Required for registry + creation. Possible values include: "Classic", "Basic", "Standard", "Premium". + :paramtype name: str or ~azure.mgmt.containerregistry.v2021_09_01.models.SkuName + """ + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class Source(msrest.serialization.Model): + """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. + + :ivar addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str + """ + + _attribute_map = { + 'addr': {'key': 'addr', 'type': 'str'}, + 'instance_id': {'key': 'instanceID', 'type': 'str'}, + } + + def __init__( + self, + *, + addr: Optional[str] = None, + instance_id: Optional[str] = None, + **kwargs + ): + """ + :keyword addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :paramtype addr: str + :keyword instance_id: The running instance of an application. Changes after each restart. + :paramtype instance_id: str + """ + super(Source, self).__init__(**kwargs) + self.addr = addr + self.instance_id = instance_id + + +class Status(msrest.serialization.Model): + """The status of an Azure resource at the time the operation was called. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar display_status: The short label for the status. + :vartype display_status: str + :ivar message: The detailed message for the status, including alerts and error messages. + :vartype message: str + :ivar timestamp: The timestamp when the status was changed to the current value. + :vartype timestamp: ~datetime.datetime + """ + + _validation = { + 'display_status': {'readonly': True}, + 'message': {'readonly': True}, + 'timestamp': {'readonly': True}, + } + + _attribute_map = { + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Status, self).__init__(**kwargs) + self.display_status = None + self.message = None + self.timestamp = None + + +class StorageAccountProperties(msrest.serialization.Model): + """The properties of a storage account for a container registry. Only applicable to Classic SKU. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. The resource ID of the storage account. + :vartype id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + """ + :keyword id: Required. The resource ID of the storage account. + :paramtype id: str + """ + super(StorageAccountProperties, self).__init__(**kwargs) + self.id = id + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.v2021_09_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". + :vartype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.LastModifiedByType + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "LastModifiedByType"]] = 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". + :paramtype created_by_type: str or + ~azure.mgmt.containerregistry.v2021_09_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". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Target(msrest.serialization.Model): + """The target of the event. + + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: long + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: long + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str + """ + + _attribute_map = { + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'long'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'long'}, + 'repository': {'key': 'repository', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + media_type: Optional[str] = None, + size: Optional[int] = None, + digest: Optional[str] = None, + length: Optional[int] = None, + repository: Optional[str] = None, + url: Optional[str] = None, + tag: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword media_type: The MIME type of the referenced object. + :paramtype media_type: str + :keyword size: The number of bytes of the content. Same as Length field. + :paramtype size: long + :keyword digest: The digest of the content, as defined by the Registry V2 HTTP API + Specification. + :paramtype digest: str + :keyword length: The number of bytes of the content. Same as Size field. + :paramtype length: long + :keyword repository: The repository name. + :paramtype repository: str + :keyword url: The direct URL to the content. + :paramtype url: str + :keyword tag: The tag name. + :paramtype tag: str + :keyword name: The name of the artifact. + :paramtype name: str + :keyword version: The version of the artifact. + :paramtype version: str + """ + super(Target, self).__init__(**kwargs) + self.media_type = media_type + self.size = size + self.digest = digest + self.length = length + self.repository = repository + self.url = url + self.tag = tag + self.name = name + self.version = version + + +class TrustPolicy(msrest.serialization.Model): + """The content trust policy for a container registry. + + :ivar type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_09_01.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PolicyStatus + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "TrustPolicyType"]] = "Notary", + status: Optional[Union[str, "PolicyStatus"]] = None, + **kwargs + ): + """ + :keyword type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :paramtype type: str or ~azure.mgmt.containerregistry.v2021_09_01.models.TrustPolicyType + :keyword status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.PolicyStatus + """ + super(TrustPolicy, self).__init__(**kwargs) + self.type = type + self.status = status + + +class UserIdentityProperties(msrest.serialization.Model): + """UserIdentityProperties. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + client_id: Optional[str] = None, + **kwargs + ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ + super(UserIdentityProperties, self).__init__(**kwargs) + self.principal_id = principal_id + self.client_id = client_id + + +class Webhook(Resource): + """An object that represents a webhook for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: Required. The location of the resource. This cannot be changed after the + resource is created. + :vartype location: str + :ivar tags: A set of tags. The tags of the resource. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_09_01.models.SystemData + :ivar status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookAction] + :ivar provisioning_state: The provisioning state of the webhook at the time the operation was + called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_09_01.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "WebhookStatus"]] = None, + scope: Optional[str] = None, + actions: Optional[List[Union[str, "WebhookAction"]]] = None, + **kwargs + ): + """ + :keyword location: Required. The location of the resource. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword tags: A set of tags. The tags of the resource. + :paramtype tags: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookAction] + """ + super(Webhook, self).__init__(location=location, tags=tags, **kwargs) + self.status = status + self.scope = scope + self.actions = actions + self.provisioning_state = None + + +class WebhookCreateParameters(msrest.serialization.Model): + """The parameters for creating a webhook. + + All required parameters must be populated in order to send to Azure. + + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :vartype location: str + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookAction] + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + service_uri: Optional[str] = None, + custom_headers: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "WebhookStatus"]] = None, + scope: Optional[str] = None, + actions: Optional[List[Union[str, "WebhookAction"]]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :paramtype location: str + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookAction] + """ + super(WebhookCreateParameters, self).__init__(**kwargs) + self.tags = tags + self.location = location + self.service_uri = service_uri + self.custom_headers = custom_headers + self.status = status + self.scope = scope + self.actions = actions + + +class WebhookListResult(msrest.serialization.Model): + """The result of a request to list webhooks for a container registry. + + :ivar value: The list of webhooks. Since this list may be incomplete, the nextLink field should + be used to request the next list of webhooks. + :vartype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Webhook] + :ivar next_link: The URI that can be used to request the next list of webhooks. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Webhook]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Webhook"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :paramtype value: list[~azure.mgmt.containerregistry.v2021_09_01.models.Webhook] + :keyword next_link: The URI that can be used to request the next list of webhooks. + :paramtype next_link: str + """ + super(WebhookListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class WebhookUpdateParameters(msrest.serialization.Model): + """The parameters for updating a webhook. + + :ivar tags: A set of tags. The tags for the webhook. + :vartype tags: dict[str, str] + :ivar service_uri: The service URI for the webhook to post notifications. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + :ivar status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookStatus + :ivar scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :vartype scope: str + :ivar actions: The list of actions that trigger the webhook to post notifications. + :vartype actions: list[str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookAction] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + service_uri: Optional[str] = None, + custom_headers: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "WebhookStatus"]] = None, + scope: Optional[str] = None, + actions: Optional[List[Union[str, "WebhookAction"]]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The tags for the webhook. + :paramtype tags: dict[str, str] + :keyword service_uri: The service URI for the webhook to post notifications. + :paramtype service_uri: str + :keyword custom_headers: Custom headers that will be added to the webhook notifications. + :paramtype custom_headers: dict[str, str] + :keyword status: The status of the webhook at the time the operation was called. Possible + values include: "enabled", "disabled". + :paramtype status: str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookStatus + :keyword scope: The scope of repositories where the event can be triggered. For example, + 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' + only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + :paramtype scope: str + :keyword actions: The list of actions that trigger the webhook to post notifications. + :paramtype actions: list[str or ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookAction] + """ + super(WebhookUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.service_uri = service_uri + self.custom_headers = custom_headers + self.status = status + self.scope = scope + self.actions = actions diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/__init__.py new file mode 100644 index 000000000000..ac77adfaf7af --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._registries_operations import RegistriesOperations +from ._operations import Operations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._replications_operations import ReplicationsOperations +from ._webhooks_operations import WebhooksOperations + +__all__ = [ + 'RegistriesOperations', + 'Operations', + 'PrivateEndpointConnectionsOperations', + 'ReplicationsOperations', + 'WebhooksOperations', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_operations.py new file mode 100644 index 000000000000..51952b4d2968 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_operations.py @@ -0,0 +1,135 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerRegistry/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: + """Lists all of the available Azure Container Registry REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ContainerRegistry/operations'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..179f61c8f764 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,565 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + """List all private endpoint connections in a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Get the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: + """Update the state of specified private endpoint connection associated with the container + registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + '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( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_registries_operations.py new file mode 100644 index 000000000000..4a4701abe053 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_registries_operations.py @@ -0,0 +1,1524 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_import_image_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_link_resources_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resource_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "groupName": _SERIALIZER.url("group_name", group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_credential_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class RegistriesOperations(object): + """RegistriesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _import_image_initial( + self, + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImportImageParameters') + + request = build_import_image_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._import_image_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + + @distributed_trace + def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> LROPoller[None]: + """Copies an image to this container registry from the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. + :type parameters: ~azure.mgmt.containerregistry.v2021_09_01.models.ImportImageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._import_image_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + @distributed_trace + def check_name_availability( + self, + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": + """Checks whether the container registry name is available for use. The name must contain only + alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + + :param registry_name_check_request: The object containing information for the availability + request. + :type registry_name_check_request: + ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryNameCheckRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryNameStatus, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryNameStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryNameStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryNameStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: + """Lists all the container registries under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RegistryListResult"]: + """Lists all the container registries under the specified resource group. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": + """Gets the properties of the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Registry, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.Registry + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry, 'Registry') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry: The parameters for creating a container registry. + :type registry: ~azure.mgmt.containerregistry.v2021_09_01.models.Registry + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry=registry, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Registry', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Registry"]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. + :type registry_update_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Registry] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry_update_parameters=registry_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Registry', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + @distributed_trace + def list_usages( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": + """Gets the quota usages for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryUsageListResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryUsageListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_usages.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryUsageListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + + @distributed_trace + def list_private_link_resources( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: + """Lists the private link resources for a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_private_link_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources'} # type: ignore + + @distributed_trace + def get_private_link_resource( + self, + resource_group_name: str, + registry_name: str, + group_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": + """Gets a private link resource by a specified group name for a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param group_name: The name of the private link resource. + :type group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.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', {})) + + + request = build_get_private_link_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + group_name=group_name, + template_url=self.get_private_link_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_private_link_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName}'} # type: ignore + + + @distributed_trace + def list_credentials( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": + """Lists the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + + @distributed_trace + def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": + """Regenerates one of the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.RegenerateCredentialParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + request = build_regenerate_credential_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_replications_operations.py new file mode 100644 index 000000000000..d57adbfb51f9 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_replications_operations.py @@ -0,0 +1,738 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + replication_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "replicationName": _SERIALIZER.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class ReplicationsOperations(object): + """ReplicationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationListResult"]: + """Lists all the replications for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.ReplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ReplicationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": + """Gets the properties of the specified replication. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replication, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.Replication + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication, 'Replication') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: + """Creates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication: The parameters for creating a replication. + :type replication: ~azure.mgmt.containerregistry.v2021_09_01.models.Replication + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication=replication, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Replication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a replication from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Replication"]: + """Updates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. + :type replication_update_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.ReplicationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Replication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication_update_parameters=replication_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Replication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_webhooks_operations.py new file mode 100644 index 000000000000..c7d12215e042 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/operations/_webhooks_operations.py @@ -0,0 +1,1037 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_ping_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_events_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_callback_config_request( + subscription_id: str, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', min_length=1), + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class WebhooksOperations(object): + """WebhooksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> Iterable["_models.WebhookListResult"]: + """Lists all the webhooks for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebhookListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.WebhookListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebhookListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": + """Gets the properties of the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Webhook, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.Webhook + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: + """Creates a webhook for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. + :type webhook_create_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Webhook or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_create_parameters=webhook_create_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Webhook', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a webhook from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Webhook"]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. + :type webhook_update_parameters: + ~azure.mgmt.containerregistry.v2021_09_01.models.WebhookUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Webhook or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_09_01.models.Webhook] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_update_parameters=webhook_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Webhook', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + @distributed_trace + def ping( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": + """Triggers a ping event to be sent to the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventInfo, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.EventInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_ping_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.ping.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + + @distributed_trace + def list_events( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> Iterable["_models.EventListResult"]: + """Lists recent events for the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_09_01.models.EventListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.list_events.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_events_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EventListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_events.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'} # type: ignore + + @distributed_trace + def get_callback_config( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": + """Gets the configuration of service URI and custom headers for the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CallbackConfig, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_09_01.models.CallbackConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CallbackConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_callback_config_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + template_url=self.get_callback_config.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CallbackConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/py.typed b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_09_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file